Revision 3f7e4e14 kamaki/clients/storage/__init__.py

b/kamaki/clients/storage/__init__.py
280 280
        if r.status_code == 404:
281 281
            raise ClientError("Object %s not found" % obj, r.status_code)
282 282

  
283
    def list_objects(self):
283
    def list_objects(
284
            self,
285
            limit=None,
286
            marker=None,
287
            prefix=None,
288
            format=None,
289
            delimiter=None,
290
            path=None):
284 291
        """
292
        :param limit: (integer) The amount of results requested
293

  
294
        :param marker: (string) Return containers with name lexicographically
295
            after marker
296

  
297
        :param prefix: (string) Return objects starting with prefix
298

  
299
        :param format: (string) reply format can be json or xml (default:json)
300

  
301
        :param delimiter: (string) Return objects up to the delimiter
302

  
303
        :param path: (string) assume prefix = path and delimiter = /
304
            (overwrites prefix and delimiter)
305

  
285 306
        :returns: (dict)
286 307

  
287 308
        :raises ClientError: 404 Invalid account
288 309
        """
289 310
        self._assert_container()
290
        path = path4url(self.account, self.container)
291
        self.set_param('format', 'json')
292
        r = self.get(path, success=(200, 204, 304, 404), )
311
        restpath = path4url(self.account, self.container)
312

  
313
        self.set_param('format', format or 'json')
314

  
315
        self.set_param('limit', limit, iff=limit)
316
        self.set_param('marker', marker, iff=marker)
317
        if path:
318
            self.set_param('path', path)
319
        else:
320
            self.set_param('prefix', prefix, iff=prefix)
321
            self.set_param('delimiter', delimiter, iff=delimiter)
322

  
323
        r = self.get(restpath, success=(200, 204, 304, 404), )
293 324
        if r.status_code == 404:
294 325
            raise ClientError(
295 326
                "Invalid account (%s) for that container" % self.account,

Also available in: Unified diff