changeset 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 a8635cdab3c0
children e2af60e480ce
files rhodecode/model/db.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/db.py	Wed Jun 06 17:55:19 2012 +0200
+++ b/rhodecode/model/db.py	Wed Jun 06 18:03:53 2012 +0200
@@ -535,6 +535,11 @@
         return q.scalar()
 
     @classmethod
+    def get_by_full_path(cls, repo_full_path):
+        repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
+        return cls.get_by_repo_name(repo_name.strip(URL_SEP))
+
+    @classmethod
     def get_repo_forks(cls, repo_id):
         return cls.query().filter(Repository.fork_id == repo_id)