comparison rhodecode/config/routing.py @ 3458:0ad025ee005e beta

better detection of deleting groups with subgroups inside. Added less strict checks on delete group routing so we can delete zombie groups (those that are not in filesystem but in DB)
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 05 Mar 2013 22:37:58 +0100
parents 5706f6ab60cf
children c177f304eb40
comparison
equal deleted inserted replaced
3457:08e8115585bd 3458:0ad025ee005e
53 :param environ: 53 :param environ:
54 :param match_dict: 54 :param match_dict:
55 """ 55 """
56 repos_group_name = match_dict.get('group_name') 56 repos_group_name = match_dict.get('group_name')
57 return is_valid_repos_group(repos_group_name, config['base_path']) 57 return is_valid_repos_group(repos_group_name, config['base_path'])
58
59 def check_group_skip_path(environ, match_dict):
60 """
61 check for valid repository group for proper 404 handling, but skips
62 verification of existing path
63
64 :param environ:
65 :param match_dict:
66 """
67 repos_group_name = match_dict.get('group_name')
68 return is_valid_repos_group(repos_group_name, config['base_path'],
69 skip_path_check=True)
58 70
59 def check_int(environ, match_dict): 71 def check_int(environ, match_dict):
60 return match_dict.get('id').isdigit() 72 return match_dict.get('id').isdigit()
61 73
62 # The ErrorController route (handles 404/500 error pages); it should 74 # The ErrorController route (handles 404/500 error pages); it should
169 m.connect("update_repos_group", "/repos_groups/{group_name:.*?}", 181 m.connect("update_repos_group", "/repos_groups/{group_name:.*?}",
170 action="update", conditions=dict(method=["PUT"], 182 action="update", conditions=dict(method=["PUT"],
171 function=check_group)) 183 function=check_group))
172 m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}", 184 m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}",
173 action="delete", conditions=dict(method=["DELETE"], 185 action="delete", conditions=dict(method=["DELETE"],
174 function=check_group)) 186 function=check_group_skip_path))
175 m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit", 187 m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit",
176 action="edit", conditions=dict(method=["GET"],)) 188 action="edit", conditions=dict(method=["GET"],
189 function=check_group))
177 m.connect("formatted_edit_repos_group", 190 m.connect("formatted_edit_repos_group",
178 "/repos_groups/{group_name:.*?}.{format}/edit", 191 "/repos_groups/{group_name:.*?}.{format}/edit",
179 action="edit", conditions=dict(method=["GET"], 192 action="edit", conditions=dict(method=["GET"],
180 function=check_group)) 193 function=check_group))
181 m.connect("repos_group", "/repos_groups/{group_name:.*?}", 194 m.connect("repos_group", "/repos_groups/{group_name:.*?}",