diff --git a/oioswift/proxy/controllers/account.py b/oioswift/proxy/controllers/account.py index b26ab4fa..9e7e0a0f 100644 --- a/oioswift/proxy/controllers/account.py +++ b/oioswift/proxy/controllers/account.py @@ -39,6 +39,8 @@ from oioswift.utils import handle_oio_timeout, handle_service_busy, \ REQID_HEADER +from oioswift.common.middleware.container_hierarchy \ + import ContainerHierarchyMiddleware as CH def get_response_headers(info): @@ -57,7 +59,7 @@ def get_response_headers(info): def account_listing_response(account, req, response_content_type, - info=None, listing=None): + info=None, listing=None, s3_buckets_only=False): now = time.time() if info is None: info = {'containers': 0, @@ -77,7 +79,8 @@ def account_listing_response(account, req, response_content_type, data = [] for (name, object_count, bytes_used, is_subdir, mtime) in listing: if is_subdir: - data.append({'subdir': name}) + if not s3_buckets_only: + data.append({'subdir': name}) else: data.append({'name': name, 'count': object_count, 'bytes': bytes_used, @@ -88,8 +91,9 @@ def account_listing_response(account, req, response_content_type, '' % saxutils.quoteattr(account)] for (name, object_count, bytes_used, is_subdir, mtime) in listing: if is_subdir: - output_list.append( - '' % saxutils.quoteattr(name)) + if not s3_buckets_only: + output_list.append( + '' % saxutils.quoteattr(name)) else: item = '%s%s' \ '%s%s' \ @@ -174,6 +178,7 @@ def get_account_listing_resp(self, req): s3_buckets_only = False if req.environ.get('swift.source') == 'S3': s3_buckets_only = True + delimiter = CH.ENCODED_DELIMITER[0] oio_headers = {REQID_HEADER: self.trans_id} info = None @@ -195,7 +200,7 @@ def get_account_listing_resp(self, req): delimiter=delimiter, headers=oio_headers) return account_listing_response( self.account_name, req, get_listing_content_type(req), - info=info, listing=listing) + info=info, listing=listing, s3_buckets_only=s3_buckets_only) @public @handle_account_not_found_autocreate