model: log exception if multiple repos rather than hard error
This commit is contained in:
parent
114e4097ca
commit
f43669f817
1 changed files with 5 additions and 4 deletions
|
|
@ -1379,10 +1379,11 @@ class Repository(Base, BaseModel):
|
|||
if cls == item_cls and instance.repo_name == repo_name:
|
||||
exist_in_session.append(instance)
|
||||
if exist_in_session:
|
||||
if len(exist_in_session) > 1:
|
||||
raise Exception('2 same name repos in session')
|
||||
return exist_in_session[0]
|
||||
|
||||
if len(exist_in_session) == 1:
|
||||
return exist_in_session[0]
|
||||
log.exception(
|
||||
'multiple repos with same name: %r' % exist_in_session)
|
||||
|
||||
q = session.query(cls).filter(cls.repo_name == repo_name)
|
||||
return q.scalar()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue