Revision 63092950 snf-pithos-app/pithos/api/functions.py
b/snf-pithos-app/pithos/api/functions.py | ||
---|---|---|
228 | 228 |
accounts = request.backend.list_accounts(request.user_uniq, marker, limit) |
229 | 229 |
|
230 | 230 |
if request.serialization == 'text': |
231 |
names = [d['name'] for d in accounts] |
|
231 | 232 |
if TRANSLATE_UUIDS: |
232 |
accounts = retrieve_displaynames(
|
|
233 |
getattr(request, 'token', None), accounts)
|
|
233 |
names = retrieve_displaynames(
|
|
234 |
getattr(request, 'token', None), names)
|
|
234 | 235 |
if len(accounts) == 0: |
235 | 236 |
# The cloudfiles python bindings expect 200 if json/xml. |
236 | 237 |
response.status_code = 204 |
237 | 238 |
return response |
238 | 239 |
response.status_code = 200 |
239 |
response.content = '\n'.join(accounts) + '\n'
|
|
240 |
response.content = '\n'.join(names) + '\n'
|
|
240 | 241 |
return response |
241 | 242 |
|
242 | 243 |
account_meta = [] |
243 |
for x in accounts:
|
|
244 |
if x == request.user_uniq:
|
|
244 |
for meta in accounts:
|
|
245 |
if meta['name'] == request.user_uniq:
|
|
245 | 246 |
continue |
246 |
try: |
|
247 |
meta = request.backend.get_account_meta( |
|
248 |
request.user_uniq, x, 'pithos', include_user_defined=False) |
|
249 |
groups = request.backend.get_account_groups(request.user_uniq, x) |
|
250 |
except NotAllowedError: |
|
251 |
raise faults.Forbidden('Not allowed') |
|
252 |
else: |
|
253 |
rename_meta_key(meta, 'modified', 'last_modified') |
|
254 |
rename_meta_key( |
|
255 |
meta, 'until_timestamp', 'x_account_until_timestamp') |
|
256 |
if groups: |
|
257 |
meta['X-Account-Group'] = printable_header_dict( |
|
258 |
dict([(k, ','.join(v)) for k, v in groups.iteritems()])) |
|
259 |
account_meta.append(printable_header_dict(meta)) |
|
247 |
rename_meta_key(meta, 'modified', 'last_modified') |
|
248 |
account_meta.append(printable_header_dict(meta)) |
|
260 | 249 |
|
261 | 250 |
if TRANSLATE_UUIDS: |
262 | 251 |
uuids = list(d['name'] for d in account_meta) |
Also available in: Unified diff