Add object type filtering to iter_resources

This commit is contained in:
Laurent Bachelier 2012-02-05 13:30:02 +01:00
commit bfb3689456
16 changed files with 92 additions and 61 deletions

View file

@ -74,11 +74,12 @@ class Transfer(CapBaseObject):
self.add_field('recipient', (int, long, basestring))
class ICapBank(ICapCollection):
def iter_resources(self, split_path):
if len(split_path) > 0:
raise CollectionNotFound(split_path)
def iter_resources(self, objs, split_path):
if Account in objs:
if len(split_path) > 0:
raise CollectionNotFound(split_path)
return self.iter_accounts()
return self.iter_accounts()
def iter_accounts(self):
raise NotImplementedError()

View file

@ -91,7 +91,7 @@ class ICapCollection(IBaseCap):
lst.append(resource)
return lst
def iter_resources(self, split_path):
def iter_resources(self, objs, split_path):
"""
split_path is a list, either empty (root path) or with one or many
components.