Revision 2535deff
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
330 | 330 |
if public: |
331 | 331 |
allowed.extend([x[0].split('/', 2)[1] for x in self.permissions.public_list(account)]) |
332 | 332 |
allowed = list(set(allowed)) |
333 |
allowed.sort() |
|
333 | 334 |
start, limit = self._list_limits(allowed, marker, limit) |
334 | 335 |
return allowed[start:start + limit] |
335 | 336 |
node = self.node.node_lookup(account) |
... | ... | |
489 | 490 |
if public: |
490 | 491 |
allowed.extend([x[0] for x in self.permissions.public_list(path)]) |
491 | 492 |
allowed = list(set(allowed)) |
493 |
allowed.sort() |
|
492 | 494 |
if not allowed: |
493 | 495 |
return [] |
494 | 496 |
return allowed |
b/snf-pithos-tools/pithos/tools/lib/client.py | ||
---|---|---|
562 | 562 |
|
563 | 563 |
def list_containers(self, format='text', if_modified_since=None, |
564 | 564 |
if_unmodified_since=None, limit=None, marker=None, |
565 |
shared=False, until=None, account=None): |
|
565 |
shared=False, until=None, account=None, public=False):
|
|
566 | 566 |
"""returns a list with the account containers""" |
567 | 567 |
account = account or self.account |
568 | 568 |
params = {'until':until} if until else {} |
569 | 569 |
if shared: |
570 | 570 |
params['shared'] = None |
571 |
if public: |
|
572 |
params['public'] = None |
|
571 | 573 |
headers = {'if-modified-since':if_modified_since, |
572 | 574 |
'if-unmodified-since':if_unmodified_since} |
573 | 575 |
return OOS_Client.list_containers(self, account=account, format=format, |
... | ... | |
645 | 647 |
limit=None, marker=None, prefix=None, delimiter=None, |
646 | 648 |
path=None, shared=False, include_trashed=False, params={}, |
647 | 649 |
if_modified_since=None, if_unmodified_since=None, meta='', |
648 |
until=None, account=None): |
|
650 |
until=None, account=None, public=False):
|
|
649 | 651 |
"""returns a list with the container objects""" |
650 | 652 |
account = account or self.account |
651 | 653 |
params = {'until':until, 'meta':meta} |
652 | 654 |
if shared: |
653 | 655 |
params['shared'] = None |
656 |
if public: |
|
657 |
params['public'] = None |
|
654 | 658 |
args = locals().copy() |
655 | 659 |
for elem in ['self', 'container', 'params', 'until', 'meta']: |
656 | 660 |
args.pop(elem) |
b/snf-pithos-tools/pithos/tools/test.py | ||
---|---|---|
375 | 375 |
self.assertEqual(len(c), len(self.containers) + 1) |
376 | 376 |
except Fault, f: |
377 | 377 |
self.failIf(f.status == 304) #fail if not modified |
378 |
|
|
378 | 379 |
|
379 | 380 |
def test_if_modified_since_invalid_date(self): |
380 | 381 |
c = self.client.list_containers(if_modified_since='') |
... | ... | |
1736 | 1737 |
self.assertTrue('o1' in my_shared_objects) |
1737 | 1738 |
self.assertTrue('o2' not in my_shared_objects) |
1738 | 1739 |
|
1740 |
class List(BaseTestCase): |
|
1741 |
def setUp(self): |
|
1742 |
BaseTestCase.setUp(self) |
|
1743 |
for i in range(1, 5): |
|
1744 |
c = 'c%s' % i |
|
1745 |
self.client.create_container(c) |
|
1746 |
for j in range(1, 3): |
|
1747 |
o = 'o%s' % j |
|
1748 |
self.upload_random_data(c, o) |
|
1749 |
if i < 3: |
|
1750 |
self.client.share_object(c, 'o1', ['papagian'], read=True) |
|
1751 |
if i%2 != 0: |
|
1752 |
self.client.publish_object(c, 'o2') |
|
1753 |
|
|
1754 |
def test_shared_public(self): |
|
1755 |
self.assertEqual(self.client.list_containers(shared=True), |
|
1756 |
['c1', 'c2']) |
|
1757 |
self.assertEqual(self.client.list_containers(public=True), ['c1', 'c3']) |
|
1758 |
self.assertEqual(self.client.list_containers(shared=True, public=True), ['c1', 'c2', 'c3']) |
|
1759 |
|
|
1760 |
self.assertEqual(self.client.list_objects('c1', shared=True), ['o1']) |
|
1761 |
self.assertEqual(self.client.list_objects('c1', public=True), ['o2']) |
|
1762 |
self.assertEqual(self.client.list_objects('c1', shared=True, public=True), ['o1', 'o2']) |
|
1763 |
|
|
1764 |
self.assertEqual(self.client.list_objects('c2', shared=True), ['o1']) |
|
1765 |
self.assertEqual(self.client.list_objects('c2', public=True), '') |
|
1766 |
self.assertEqual(self.client.list_objects('c2', shared=True, public=True), ['o1']) |
|
1767 |
|
|
1768 |
self.assertEqual(self.client.list_objects('c3', shared=True), '') |
|
1769 |
self.assertEqual(self.client.list_objects('c3', public=True), ['o2']) |
|
1770 |
self.assertEqual(self.client.list_objects('c3', shared=True, public=True), ['o2']) |
|
1771 |
|
|
1772 |
self.assertEqual(self.client.list_objects('c4', shared=True), '') |
|
1773 |
self.assertEqual(self.client.list_objects('c4', public=True), '') |
|
1774 |
self.assertEqual(self.client.list_objects('c4', shared=True, public=True), '') |
|
1775 |
|
|
1739 | 1776 |
class TestGreek(BaseTestCase): |
1740 | 1777 |
def test_create_container(self): |
1741 | 1778 |
self.client.create_container('φάκελος') |
Also available in: Unified diff