Add some useful properties to Collection
This commit is contained in:
parent
1430b40bc5
commit
f4dbefb6ef
4 changed files with 47 additions and 13 deletions
|
|
@ -82,11 +82,11 @@ class CanalplusBrowser(BaseBrowser):
|
|||
|
||||
if len(split_path) == 0:
|
||||
for channel in channels:
|
||||
if len(channel.split_path) == 1:
|
||||
if channel.level == 1:
|
||||
yield channel
|
||||
elif len(split_path) == 1:
|
||||
for channel in channels:
|
||||
if len(channel.split_path) == 2 and split_path[0] == channel.split_path[0]:
|
||||
if channel.level == 2 and split_path == channel.parent:
|
||||
yield channel
|
||||
elif len(split_path) == 2:
|
||||
subchannels = self.iter_resources(split_path[0:1])
|
||||
|
|
|
|||
|
|
@ -106,15 +106,15 @@ class RedmineBackend(BaseBackend, ICapContent, ICapBugTracker, ICapCollection):
|
|||
return self.iter_issues(query)
|
||||
|
||||
def validate_collection(self, objs, collection):
|
||||
if len(collection.split_path) == 0:
|
||||
if collection.level == 0:
|
||||
return
|
||||
if Issue in objs and len(collection.split_path) == 1:
|
||||
if Issue in objs and collection.level == 1:
|
||||
for project in self.iter_projects():
|
||||
if collection.split_path[0] == project.id:
|
||||
if collection.basename == project.id:
|
||||
return Collection([project.id], project.name)
|
||||
# if the project is not found by ID, try again by name
|
||||
for project in self.iter_projects():
|
||||
if collection.split_path[0] == project.name:
|
||||
if collection.basename == project.name:
|
||||
return Collection([project.id], project.name)
|
||||
raise CollectionNotFound(collection.split_path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue