Changeset - ade3414a8b61
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-02-10 21:56:14
marcin@python-works.com
Fixed problems with repository creation
1 file changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/repo.py
Show inline comments
 
@@ -41,31 +41,33 @@ from vcs.backends import get_backend
 

	
 
log = logging.getLogger(__name__)
 

	
 
class RepoModel(BaseModel):
 

	
 
    def __init__(self, sa=None):
 
        try:
 
            from pylons import app_globals
 
            self._base_path = app_globals.base_path
 
        except:
 
            self._base_path = None
 

	
 
        @property
 
        def base_path():
 
            if self._base_path is None:
 
                raise Exception('Base Path is empty, try set this after'
 
                                'class initialization when not having '
 
                                'app_globals available')
 
            return self._base_path
 
        super(RepoModel, self).__init__(sa)
 

	
 
    @property
 
    def base_path(self):
 
        if self._base_path is None:
 
            raise Exception('Base Path is empty, try set this after'
 
                            'class initialization when not having '
 
                            'app_globals available')
 
        return self._base_path
 

	
 
        super(RepoModel, self).__init__()
 

	
 

	
 
    def get(self, repo_id, cache=False):
 
        repo = self.sa.query(Repository)\
 
            .filter(Repository.repo_id == repo_id)
 

	
 
        if cache:
 
            repo = repo.options(FromCache("sql_cache_short",
 
                                          "get_repo_%s" % repo_id))
 
        return repo.scalar()
0 comments (0 inline, 0 general)