Revision 1c366ac9 kamaki/cli/commands/pithos.py
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
273 | 273 |
until=DateArgument('show metadata until then', '--until'), |
274 | 274 |
format=ValueArgument( |
275 | 275 |
'format to parse until data (default: d/m/Y H:M:S )', '--format'), |
276 |
shared=FlagArgument('show only shared', '--shared'), |
|
276 |
shared_by_me=FlagArgument( |
|
277 |
'show only files shared to other users', '--shared-by-me'), |
|
278 |
public=FlagArgument('show only published objects', '--public'), |
|
277 | 279 |
more=FlagArgument('read long results', '--more'), |
278 | 280 |
enum=FlagArgument('Enumerate results', '--enumerate'), |
279 | 281 |
recursive=FlagArgument( |
... | ... | |
292 | 294 |
prefix=self['name_pref'], |
293 | 295 |
delimiter=self['delimiter'], |
294 | 296 |
path=self.path or '', |
297 |
show_only_shared=self['shared_by_me'], |
|
298 |
public=['public'], |
|
295 | 299 |
if_modified_since=self['if_modified_since'], |
296 | 300 |
if_unmodified_since=self['if_unmodified_since'], |
297 | 301 |
until=self['until'], |
298 |
meta=self['meta'], |
|
299 |
show_only_shared=self['shared']) |
|
302 |
meta=self['meta']) |
|
300 | 303 |
files = self._filter_by_name(r.json) |
301 | 304 |
if self['more']: |
302 | 305 |
outbu, self._out = self._out, StringIO() |
... | ... | |
359 | 362 |
read, write = perms.get('read', ''), perms.get('write', '') |
360 | 363 |
read = read.split(',') if read else [] |
361 | 364 |
write = write.split(',') if write else [] |
362 |
read += self['uuid_for_read_permission']
|
|
363 |
write += self['uuid_for_write_permission']
|
|
365 |
read += (self['uuid_for_read_permission'] or [])
|
|
366 |
write += (self['uuid_for_write_permission'] or [])
|
|
364 | 367 |
self.client.set_object_sharing( |
365 | 368 |
self.path, read_permission=read, write_permission=write) |
366 | 369 |
self.print_dict(self.client.get_object_sharing(self.path)) |
367 | 370 |
if self['no_permissions']: |
368 | 371 |
self.client.del_object_sharing(self.path) |
369 | 372 |
metadata = self['metadata_to_set'] or dict() |
370 |
for k in self['metadata_key_to_delete']:
|
|
373 |
for k in (self['metadata_key_to_delete'] or []):
|
|
371 | 374 |
metadata[k] = '' |
372 | 375 |
if metadata: |
373 | 376 |
self.client.set_object_meta(self.path, metadata) |
... | ... | |
1386 | 1389 |
enum=FlagArgument('Enumerate results', '--enumerate'), |
1387 | 1390 |
recursive=FlagArgument( |
1388 | 1391 |
'Recursively list containers and their contents', |
1389 |
('-r', '--recursive')) |
|
1392 |
('-r', '--recursive')), |
|
1393 |
shared_by_me=FlagArgument( |
|
1394 |
'show only files shared to other users', '--shared-by-me'), |
|
1395 |
public=FlagArgument('show only published objects', '--public'), |
|
1390 | 1396 |
) |
1391 | 1397 |
|
1392 | 1398 |
def print_containers(self, container_list): |
... | ... | |
1424 | 1430 |
if_modified_since=self['modified_since_date'], |
1425 | 1431 |
if_unmodified_since=self['unmodified_since_date'], |
1426 | 1432 |
until=self['until_date'], |
1427 |
show_only_shared=self['shared']) |
|
1433 |
show_only_shared=self['shared_by_me'], |
|
1434 |
public=self['public']) |
|
1428 | 1435 |
container['objects'] = objects.json |
1429 | 1436 |
finally: |
1430 | 1437 |
self.client.container = None |
... | ... | |
1441 | 1448 |
if_modified_since=self['modified_since_date'], |
1442 | 1449 |
if_unmodified_since=self['unmodified_since_date'], |
1443 | 1450 |
until=self['until_date'], |
1444 |
show_only_shared=self['shared']) |
|
1451 |
show_only_shared=self['shared_by_me'], |
|
1452 |
public=self['public']) |
|
1445 | 1453 |
else: |
1446 | 1454 |
r = self.client.account_get( |
1447 | 1455 |
limit=False if self['more'] else self['limit'], |
... | ... | |
1449 | 1457 |
if_modified_since=self['modified_since_date'], |
1450 | 1458 |
if_unmodified_since=self['unmodified_since_date'], |
1451 | 1459 |
until=self['until_date'], |
1452 |
show_only_shared=self['shared']) |
|
1460 |
show_only_shared=self['shared_by_me'], |
|
1461 |
public=self['public']) |
|
1453 | 1462 |
files = self._filter_by_name(r.json) |
1454 | 1463 |
if self['recursive'] and not container: |
1455 | 1464 |
self._create_object_forest(files) |
... | ... | |
1678 | 1687 |
def main(self, groupname): |
1679 | 1688 |
super(self.__class__, self)._run() |
1680 | 1689 |
self._run(groupname) |
1690 |
|
|
1691 |
|
|
1692 |
# Deprecated commands |
|
1693 |
|
|
1694 |
@command(file_cmds) |
|
1695 |
class file_publish(_pithos_init): |
|
1696 |
"""DEPRECATED, replaced by [kamaki] file modify OBJECT --publish""" |
|
1697 |
|
|
1698 |
def main(self, *args): |
|
1699 |
raise CLISyntaxError('DEPRECATED', details=[ |
|
1700 |
'This command is replaced by:', |
|
1701 |
' [kamaki] file modify OBJECT --publish']) |
|
1702 |
|
|
1703 |
|
|
1704 |
@command(file_cmds) |
|
1705 |
class file_unpublish(_pithos_init): |
|
1706 |
"""DEPRECATED, replaced by [kamaki] file modify OBJECT --unpublish""" |
|
1707 |
|
|
1708 |
def main(self, *args): |
|
1709 |
raise CLISyntaxError('DEPRECATED', details=[ |
|
1710 |
'This command is replaced by:', |
|
1711 |
' [kamaki] file modify OBJECT --unpublish']) |
Also available in: Unified diff