Show More
@@ -1374,10 +1374,15 b' class Repository(Base, BaseModel):' | |||
|
1374 | 1374 | @classmethod |
|
1375 | 1375 | def get_by_repo_name(cls, repo_name): |
|
1376 | 1376 | session = Session() |
|
1377 | exist_in_session = [] | |
|
1377 | 1378 | for (item_cls, pkey), instance in session.identity_map.items(): |
|
1378 | 1379 | if cls == item_cls and instance.repo_name == repo_name: |
|
1379 |
|
|
|
1380 | ||
|
1380 | exist_in_session.append(instance) | |
|
1381 | if exist_in_session: | |
|
1382 | if len(exist_in_session) > 1: | |
|
1383 | raise Exception('2 same name repos in session') | |
|
1384 | return exist_in_session[0] | |
|
1385 | ||
|
1381 | 1386 | q = session.query(cls).filter(cls.repo_name == repo_name) |
|
1382 | 1387 | return q.scalar() |
|
1383 | 1388 |
General Comments 0
You need to be logged in to leave comments.
Login now