Changeset - 8e87c16ac58e
[Not reviewed]
default
0 2 0
Mads Kiilerich - 10 years ago 2015-07-23 00:52:29
madski@unity3d.com
db: remove unused repository groups_choices parameter show_empty_group
2 files changed with 4 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -1510,34 +1510,28 @@ class RepoGroup(Base, BaseModel):
 
        return u"<%s('id:%s:%s')>" % (self.__class__.__name__, self.group_id,
 
                                      self.group_name)
 

	
 
    @classmethod
 
    def _generate_choice(cls, repo_group):
 
        """Return tuple with group_id and name as html literal"""
 
        from webhelpers.html import literal
 
        if repo_group is None:
 
            return (-1, u'-- %s --' % _('top level'))
 
        return repo_group.group_id, literal(cls.SEP.join(repo_group.full_path_splitted))
 

	
 
    @classmethod
 
    def groups_choices(cls, groups, show_empty_group=True):
 
    def groups_choices(cls, groups):
 
        """Return tuples with group_id and name as html literal."""
 

	
 
        if show_empty_group:
 
            groups = list(groups)
 
            groups.append(None)
 

	
 
        choices = [cls._generate_choice(g) for g in groups]
 

	
 
        return sorted(choices, key=lambda c: c[1].split(cls.SEP))
 
        return sorted((cls._generate_choice(g) for g in groups),
 
                      key=lambda c: c[1].split(cls.SEP))
 

	
 
    @classmethod
 
    def url_sep(cls):
 
        return URL_SEP
 

	
 
    @classmethod
 
    def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):
 
        if case_insensitive:
 
            gr = cls.query()\
 
                .filter(cls.group_name.ilike(group_name))
 
        else:
 
            gr = cls.query()\
kallithea/model/scm.py
Show inline comments
 
@@ -892,13 +892,13 @@ def AvailableRepoGroupChoices(top_perms,
 
    Top level is -1.
 
    """
 
    groups = RepoGroup.query().all()
 
    if HasPermissionAll('hg.admin')('available repo groups'):
 
        groups.append(None)
 
    else:
 
        groups = list(RepoGroupList(groups, perm_set=repo_group_perms))
 
        if top_perms and HasPermissionAny(*top_perms)('available repo groups'):
 
            groups.append(None)
 
        for extra in extras:
 
            if not any(rg == extra for rg in groups):
 
                groups.append(extra)
 
    return RepoGroup.groups_choices(groups=groups, show_empty_group=False)
 
    return RepoGroup.groups_choices(groups=groups)
0 comments (0 inline, 0 general)