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

@ -94,17 +94,18 @@ class RedmineBackend(BaseBackend, ICapContent, ICapBugTracker, ICapCollection):
return self.browser.get_wiki_preview(project, page, content.content)
############# CapCollection ###################################################
def iter_resources(self, split_path):
if len(split_path) == 0:
return [Collection(project.id, project.name, fct=self.iter_issues)
for project in self.iter_projects()]
def iter_resources(self, objs, split_path):
if Project in objs or Issue in objs:
if len(split_path) == 0:
return [Collection(project.id, project.name, fct=self.iter_issues)
for project in self.iter_projects()]
if len(split_path) == 1:
query = Query()
query.project = unicode(split_path[0])
return self.iter_issues(query)
if len(split_path) == 1:
query = Query()
query.project = unicode(split_path[0])
return self.iter_issues(query)
raise CollectionNotFound(split_path)
raise CollectionNotFound(split_path)
############# CapBugTracker ###################################################