Mercurial > kallithea
comparison rhodecode/model/db.py @ 2400:e87c6aa9c5e7 beta
Add method for fetching repos by full path
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Jun 2012 18:03:53 +0200 |
parents | 2da7b5984ae5 |
children | e2af60e480ce |
comparison
equal
deleted
inserted
replaced
2399:a8635cdab3c0 | 2400:e87c6aa9c5e7 |
---|---|
531 q = Session.query(cls).filter(cls.repo_name == repo_name) | 531 q = Session.query(cls).filter(cls.repo_name == repo_name) |
532 q = q.options(joinedload(Repository.fork))\ | 532 q = q.options(joinedload(Repository.fork))\ |
533 .options(joinedload(Repository.user))\ | 533 .options(joinedload(Repository.user))\ |
534 .options(joinedload(Repository.group)) | 534 .options(joinedload(Repository.group)) |
535 return q.scalar() | 535 return q.scalar() |
536 | |
537 @classmethod | |
538 def get_by_full_path(cls, repo_full_path): | |
539 repo_name = repo_full_path.split(cls.base_path(), 1)[-1] | |
540 return cls.get_by_repo_name(repo_name.strip(URL_SEP)) | |
536 | 541 |
537 @classmethod | 542 @classmethod |
538 def get_repo_forks(cls, repo_id): | 543 def get_repo_forks(cls, repo_id): |
539 return cls.query().filter(Repository.fork_id == repo_id) | 544 return cls.query().filter(Repository.fork_id == repo_id) |
540 | 545 |