Changeset - 7d687ed11929
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 14 years ago 2011-10-01 20:51:28
marcin@python-works.com
changed check_... functions from their stupid names to something less retarded :)
5 files changed with 13 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/config/routing.py
Show inline comments
 
@@ -20,8 +20,8 @@ def make_map(config):
 
    rmap.minimization = False
 
    rmap.explicit = False
 
    
 
    from rhodecode.lib.utils import check_repo_fast
 
    from rhodecode.lib.utils import check_repos_group_fast
 
    from rhodecode.lib.utils import is_valid_repo
 
    from rhodecode.lib.utils import is_valid_repos_group
 
    
 
    def check_repo(environ, match_dict):
 
        """
 
@@ -32,7 +32,7 @@ def make_map(config):
 
        """
 
         
 
        repo_name = match_dict.get('repo_name')
 
        return check_repo_fast(repo_name, config['base_path'])
 
        return is_valid_repo(repo_name, config['base_path'])
 

	
 
    def check_group(environ, match_dict):
 
        """
 
@@ -43,7 +43,7 @@ def make_map(config):
 
        """
 
        repos_group_name = match_dict.get('group_name')
 
        
 
        return check_repos_group_fast(repos_group_name, config['base_path'])
 
        return is_valid_repos_group(repos_group_name, config['base_path'])
 

	
 

	
 
    def check_int(environ, match_dict):
rhodecode/lib/middleware/simplegit.py
Show inline comments
 
@@ -71,7 +71,7 @@ from paste.httpheaders import REMOTE_USE
 

	
 
from rhodecode.lib import safe_str
 
from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
 
from rhodecode.lib.utils import invalidate_cache, check_repo_fast
 
from rhodecode.lib.utils import invalidate_cache, is_valid_repo
 
from rhodecode.model.db import User
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 
@@ -192,7 +192,7 @@ class SimpleGit(object):
 
        log.debug('Repository path is %s' % repo_path)
 

	
 
        # quick check if that dir exists...
 
        if check_repo_fast(repo_name, self.basepath) is False:
 
        if is_valid_repo(repo_name, self.basepath) is False:
 
            return HTTPNotFound()(environ, start_response)
 

	
 
        try:
rhodecode/lib/middleware/simplehg.py
Show inline comments
 
@@ -37,7 +37,7 @@ from paste.httpheaders import REMOTE_USE
 
from rhodecode.lib import safe_str
 
from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
 
from rhodecode.lib.utils import make_ui, invalidate_cache, \
 
    check_repo_fast, ui_sections
 
    is_valid_repo, ui_sections
 
from rhodecode.model.db import User
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 
@@ -161,7 +161,7 @@ class SimpleHg(object):
 
        
 

	
 
        # quick check if that dir exists...
 
        if check_repo_fast(repo_name, self.basepath) is False:
 
        if is_valid_repo(repo_name, self.basepath) is False:
 
            return HTTPNotFound()(environ, start_response)
 

	
 
        try:
rhodecode/lib/utils.py
Show inline comments
 
@@ -180,7 +180,7 @@ def get_repos(path, recursive=False):
 
    return _get_repos(path)
 

	
 

	
 
def check_repo_fast(repo_name, base_path):
 
def is_valid_repo(repo_name, base_path):
 
    """
 
    Returns True if given path is a valid repository False otherwise
 
    :param repo_name:
 
@@ -196,7 +196,7 @@ def check_repo_fast(repo_name, base_path
 
    except VCSError:
 
        return False
 

	
 
def check_repos_group_fast(repos_group_name, base_path):
 
def is_valid_repos_group(repos_group_name, base_path):
 
    """
 
    Returns True if given path is a repos group False otherwise
 
    
 
@@ -206,7 +206,7 @@ def check_repos_group_fast(repos_group_n
 
    full_path = os.path.join(base_path, repos_group_name)
 
    
 
    # check if it's not a repo
 
    if check_repo_fast(repos_group_name, base_path):
 
    if is_valid_repo(repos_group_name, base_path):
 
        return False
 
    
 
    # check if it's a valid path
rhodecode/model/repo.py
Show inline comments
 
@@ -301,7 +301,7 @@ class RepoModel(BaseModel):
 
        :param parent_id:
 
        :param clone_uri:
 
        """
 
        from rhodecode.lib.utils import check_repo_fast
 
        from rhodecode.lib.utils import is_valid_repo
 
        
 
        if new_parent_id:
 
            paths = Group.get(new_parent_id).full_path.split(Group.url_sep())
 
@@ -312,7 +312,7 @@ class RepoModel(BaseModel):
 
        repo_path = os.path.join(*map(lambda x:safe_str(x),
 
                                [self.repos_path, new_parent_path, repo_name]))
 

	
 
        if check_repo_fast(repo_path, self.repos_path) is False:
 
        if is_valid_repo(repo_path, self.repos_path) is False:
 
            log.info('creating repo %s in %s @ %s', repo_name, repo_path,
 
                     clone_uri)
 
            backend = get_backend(alias)
0 comments (0 inline, 0 general)