##// END OF EJS Templates
changed check_... functions from their stupid names to something less retarded :)
marcink -
r1507:7d687ed1 beta
parent child Browse files
Show More
@@ -20,8 +20,8 b' def make_map(config):'
20 rmap.minimization = False
20 rmap.minimization = False
21 rmap.explicit = False
21 rmap.explicit = False
22
22
23 from rhodecode.lib.utils import check_repo_fast
23 from rhodecode.lib.utils import is_valid_repo
24 from rhodecode.lib.utils import check_repos_group_fast
24 from rhodecode.lib.utils import is_valid_repos_group
25
25
26 def check_repo(environ, match_dict):
26 def check_repo(environ, match_dict):
27 """
27 """
@@ -32,7 +32,7 b' def make_map(config):'
32 """
32 """
33
33
34 repo_name = match_dict.get('repo_name')
34 repo_name = match_dict.get('repo_name')
35 return check_repo_fast(repo_name, config['base_path'])
35 return is_valid_repo(repo_name, config['base_path'])
36
36
37 def check_group(environ, match_dict):
37 def check_group(environ, match_dict):
38 """
38 """
@@ -43,7 +43,7 b' def make_map(config):'
43 """
43 """
44 repos_group_name = match_dict.get('group_name')
44 repos_group_name = match_dict.get('group_name')
45
45
46 return check_repos_group_fast(repos_group_name, config['base_path'])
46 return is_valid_repos_group(repos_group_name, config['base_path'])
47
47
48
48
49 def check_int(environ, match_dict):
49 def check_int(environ, match_dict):
@@ -71,7 +71,7 b' from paste.httpheaders import REMOTE_USE'
71
71
72 from rhodecode.lib import safe_str
72 from rhodecode.lib import safe_str
73 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
73 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
74 from rhodecode.lib.utils import invalidate_cache, check_repo_fast
74 from rhodecode.lib.utils import invalidate_cache, is_valid_repo
75 from rhodecode.model.db import User
75 from rhodecode.model.db import User
76
76
77 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
77 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
@@ -192,7 +192,7 b' class SimpleGit(object):'
192 log.debug('Repository path is %s' % repo_path)
192 log.debug('Repository path is %s' % repo_path)
193
193
194 # quick check if that dir exists...
194 # quick check if that dir exists...
195 if check_repo_fast(repo_name, self.basepath) is False:
195 if is_valid_repo(repo_name, self.basepath) is False:
196 return HTTPNotFound()(environ, start_response)
196 return HTTPNotFound()(environ, start_response)
197
197
198 try:
198 try:
@@ -37,7 +37,7 b' from paste.httpheaders import REMOTE_USE'
37 from rhodecode.lib import safe_str
37 from rhodecode.lib import safe_str
38 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
38 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
39 from rhodecode.lib.utils import make_ui, invalidate_cache, \
39 from rhodecode.lib.utils import make_ui, invalidate_cache, \
40 check_repo_fast, ui_sections
40 is_valid_repo, ui_sections
41 from rhodecode.model.db import User
41 from rhodecode.model.db import User
42
42
43 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
43 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
@@ -161,7 +161,7 b' class SimpleHg(object):'
161
161
162
162
163 # quick check if that dir exists...
163 # quick check if that dir exists...
164 if check_repo_fast(repo_name, self.basepath) is False:
164 if is_valid_repo(repo_name, self.basepath) is False:
165 return HTTPNotFound()(environ, start_response)
165 return HTTPNotFound()(environ, start_response)
166
166
167 try:
167 try:
@@ -180,7 +180,7 b' def get_repos(path, recursive=False):'
180 return _get_repos(path)
180 return _get_repos(path)
181
181
182
182
183 def check_repo_fast(repo_name, base_path):
183 def is_valid_repo(repo_name, base_path):
184 """
184 """
185 Returns True if given path is a valid repository False otherwise
185 Returns True if given path is a valid repository False otherwise
186 :param repo_name:
186 :param repo_name:
@@ -196,7 +196,7 b' def check_repo_fast(repo_name, base_path'
196 except VCSError:
196 except VCSError:
197 return False
197 return False
198
198
199 def check_repos_group_fast(repos_group_name, base_path):
199 def is_valid_repos_group(repos_group_name, base_path):
200 """
200 """
201 Returns True if given path is a repos group False otherwise
201 Returns True if given path is a repos group False otherwise
202
202
@@ -206,7 +206,7 b' def check_repos_group_fast(repos_group_n'
206 full_path = os.path.join(base_path, repos_group_name)
206 full_path = os.path.join(base_path, repos_group_name)
207
207
208 # check if it's not a repo
208 # check if it's not a repo
209 if check_repo_fast(repos_group_name, base_path):
209 if is_valid_repo(repos_group_name, base_path):
210 return False
210 return False
211
211
212 # check if it's a valid path
212 # check if it's a valid path
@@ -301,7 +301,7 b' class RepoModel(BaseModel):'
301 :param parent_id:
301 :param parent_id:
302 :param clone_uri:
302 :param clone_uri:
303 """
303 """
304 from rhodecode.lib.utils import check_repo_fast
304 from rhodecode.lib.utils import is_valid_repo
305
305
306 if new_parent_id:
306 if new_parent_id:
307 paths = Group.get(new_parent_id).full_path.split(Group.url_sep())
307 paths = Group.get(new_parent_id).full_path.split(Group.url_sep())
@@ -312,7 +312,7 b' class RepoModel(BaseModel):'
312 repo_path = os.path.join(*map(lambda x:safe_str(x),
312 repo_path = os.path.join(*map(lambda x:safe_str(x),
313 [self.repos_path, new_parent_path, repo_name]))
313 [self.repos_path, new_parent_path, repo_name]))
314
314
315 if check_repo_fast(repo_path, self.repos_path) is False:
315 if is_valid_repo(repo_path, self.repos_path) is False:
316 log.info('creating repo %s in %s @ %s', repo_name, repo_path,
316 log.info('creating repo %s in %s @ %s', repo_name, repo_path,
317 clone_uri)
317 clone_uri)
318 backend = get_backend(alias)
318 backend = get_backend(alias)
General Comments 0
You need to be logged in to leave comments. Login now