Mercurial > kallithea
changeset 8665:bbd96bdf8372
scm: make sure __get_repo always returns something
Avoid pytype complaint:
File ".../kallithea/model/scm.py", line 438, in get_nodes: No attribute 'scm_instance' on None [attribute-error]
In Optional[Any]
Avoid invoking __get_repo with None as parameter when creating repos.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 10 Oct 2020 13:16:59 +0200 |
parents | be839636b6e4 |
children | fb37ca246267 |
files | kallithea/model/scm.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/scm.py Sat Oct 10 13:11:13 2020 +0200 +++ b/kallithea/model/scm.py Sat Oct 10 13:16:59 2020 +0200 @@ -145,9 +145,8 @@ if instance.isdigit(): return cls.get(int(instance)) return cls.get_by_repo_name(instance) - elif instance is not None: - raise Exception('given object must be int, basestr or Instance' - ' of %s got %s' % (type(cls), type(instance))) + raise Exception('given object must be int, basestr or Instance' + ' of %s got %s' % (type(cls), type(instance))) @LazyProperty def repos_path(self): @@ -651,12 +650,12 @@ hist_l = [] choices = [] - repo = self.__get_repo(repo) hist_l.append(('rev:tip', _('latest tip'))) choices.append('rev:tip') if repo is None: return choices, hist_l + repo = self.__get_repo(repo) repo = repo.scm_instance branches_group = ([('branch:%s' % k, k) for k, v in