##// END OF EJS Templates
fix routing matching order
marcink -
r3874:237a8e37 beta
parent child Browse files
Show More
@@ -1,708 +1,708 b''
1 """
1 """
2 Routes configuration
2 Routes configuration
3
3
4 The more specific and detailed routes should be defined first so they
4 The more specific and detailed routes should be defined first so they
5 may take precedent over the more generic routes. For more information
5 may take precedent over the more generic routes. For more information
6 refer to the routes manual at http://routes.groovie.org/docs/
6 refer to the routes manual at http://routes.groovie.org/docs/
7 """
7 """
8 from __future__ import with_statement
8 from __future__ import with_statement
9 from routes import Mapper
9 from routes import Mapper
10
10
11 # prefix for non repository related links needs to be prefixed with `/`
11 # prefix for non repository related links needs to be prefixed with `/`
12 ADMIN_PREFIX = '/_admin'
12 ADMIN_PREFIX = '/_admin'
13
13
14
14
15 def make_map(config):
15 def make_map(config):
16 """Create, configure and return the routes Mapper"""
16 """Create, configure and return the routes Mapper"""
17 rmap = Mapper(directory=config['pylons.paths']['controllers'],
17 rmap = Mapper(directory=config['pylons.paths']['controllers'],
18 always_scan=config['debug'])
18 always_scan=config['debug'])
19 rmap.minimization = False
19 rmap.minimization = False
20 rmap.explicit = False
20 rmap.explicit = False
21
21
22 from rhodecode.lib.utils import is_valid_repo
22 from rhodecode.lib.utils import is_valid_repo
23 from rhodecode.lib.utils import is_valid_repos_group
23 from rhodecode.lib.utils import is_valid_repos_group
24
24
25 def check_repo(environ, match_dict):
25 def check_repo(environ, match_dict):
26 """
26 """
27 check for valid repository for proper 404 handling
27 check for valid repository for proper 404 handling
28
28
29 :param environ:
29 :param environ:
30 :param match_dict:
30 :param match_dict:
31 """
31 """
32 from rhodecode.model.db import Repository
32 from rhodecode.model.db import Repository
33 repo_name = match_dict.get('repo_name')
33 repo_name = match_dict.get('repo_name')
34
34
35 if match_dict.get('f_path'):
35 if match_dict.get('f_path'):
36 #fix for multiple initial slashes that causes errors
36 #fix for multiple initial slashes that causes errors
37 match_dict['f_path'] = match_dict['f_path'].lstrip('/')
37 match_dict['f_path'] = match_dict['f_path'].lstrip('/')
38
38
39 try:
39 try:
40 by_id = repo_name.split('_')
40 by_id = repo_name.split('_')
41 if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '':
41 if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '':
42 repo_name = Repository.get(by_id[1]).repo_name
42 repo_name = Repository.get(by_id[1]).repo_name
43 match_dict['repo_name'] = repo_name
43 match_dict['repo_name'] = repo_name
44 except Exception:
44 except Exception:
45 pass
45 pass
46
46
47 return is_valid_repo(repo_name, config['base_path'])
47 return is_valid_repo(repo_name, config['base_path'])
48
48
49 def check_group(environ, match_dict):
49 def check_group(environ, match_dict):
50 """
50 """
51 check for valid repository group for proper 404 handling
51 check for valid repository group for proper 404 handling
52
52
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
58
59 def check_group_skip_path(environ, match_dict):
59 def check_group_skip_path(environ, match_dict):
60 """
60 """
61 check for valid repository group for proper 404 handling, but skips
61 check for valid repository group for proper 404 handling, but skips
62 verification of existing path
62 verification of existing path
63
63
64 :param environ:
64 :param environ:
65 :param match_dict:
65 :param match_dict:
66 """
66 """
67 repos_group_name = match_dict.get('group_name')
67 repos_group_name = match_dict.get('group_name')
68 return is_valid_repos_group(repos_group_name, config['base_path'],
68 return is_valid_repos_group(repos_group_name, config['base_path'],
69 skip_path_check=True)
69 skip_path_check=True)
70
70
71 def check_user_group(environ, match_dict):
71 def check_user_group(environ, match_dict):
72 """
72 """
73 check for valid user group for proper 404 handling
73 check for valid user group for proper 404 handling
74
74
75 :param environ:
75 :param environ:
76 :param match_dict:
76 :param match_dict:
77 """
77 """
78 return True
78 return True
79
79
80 def check_int(environ, match_dict):
80 def check_int(environ, match_dict):
81 return match_dict.get('id').isdigit()
81 return match_dict.get('id').isdigit()
82
82
83 # The ErrorController route (handles 404/500 error pages); it should
83 # The ErrorController route (handles 404/500 error pages); it should
84 # likely stay at the top, ensuring it can always be resolved
84 # likely stay at the top, ensuring it can always be resolved
85 rmap.connect('/error/{action}', controller='error')
85 rmap.connect('/error/{action}', controller='error')
86 rmap.connect('/error/{action}/{id}', controller='error')
86 rmap.connect('/error/{action}/{id}', controller='error')
87
87
88 #==========================================================================
88 #==========================================================================
89 # CUSTOM ROUTES HERE
89 # CUSTOM ROUTES HERE
90 #==========================================================================
90 #==========================================================================
91
91
92 #MAIN PAGE
92 #MAIN PAGE
93 rmap.connect('home', '/', controller='home', action='index')
93 rmap.connect('home', '/', controller='home', action='index')
94 rmap.connect('repo_switcher', '/repos', controller='home',
94 rmap.connect('repo_switcher', '/repos', controller='home',
95 action='repo_switcher')
95 action='repo_switcher')
96 rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}',
96 rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}',
97 controller='home', action='branch_tag_switcher')
97 controller='home', action='branch_tag_switcher')
98 rmap.connect('bugtracker',
98 rmap.connect('bugtracker',
99 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
99 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
100 _static=True)
100 _static=True)
101 rmap.connect('rst_help',
101 rmap.connect('rst_help',
102 "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
102 "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
103 _static=True)
103 _static=True)
104 rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
104 rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
105
105
106 #ADMIN REPOSITORY REST ROUTES
106 #ADMIN REPOSITORY REST ROUTES
107 with rmap.submapper(path_prefix=ADMIN_PREFIX,
107 with rmap.submapper(path_prefix=ADMIN_PREFIX,
108 controller='admin/repos') as m:
108 controller='admin/repos') as m:
109 m.connect("repos", "/repos",
109 m.connect("repos", "/repos",
110 action="create", conditions=dict(method=["POST"]))
110 action="create", conditions=dict(method=["POST"]))
111 m.connect("repos", "/repos",
111 m.connect("repos", "/repos",
112 action="index", conditions=dict(method=["GET"]))
112 action="index", conditions=dict(method=["GET"]))
113 m.connect("formatted_repos", "/repos.{format}",
113 m.connect("formatted_repos", "/repos.{format}",
114 action="index",
114 action="index",
115 conditions=dict(method=["GET"]))
115 conditions=dict(method=["GET"]))
116 m.connect("new_repo", "/create_repository",
116 m.connect("new_repo", "/create_repository",
117 action="create_repository", conditions=dict(method=["GET"]))
117 action="create_repository", conditions=dict(method=["GET"]))
118 m.connect("/repos/{repo_name:.*?}",
118 m.connect("/repos/{repo_name:.*?}",
119 action="update", conditions=dict(method=["PUT"],
119 action="update", conditions=dict(method=["PUT"],
120 function=check_repo))
120 function=check_repo))
121 m.connect("/repos/{repo_name:.*?}",
121 m.connect("/repos/{repo_name:.*?}",
122 action="delete", conditions=dict(method=["DELETE"],
122 action="delete", conditions=dict(method=["DELETE"],
123 function=check_repo))
123 function=check_repo))
124 m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit",
124 m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit",
125 action="edit", conditions=dict(method=["GET"],
125 action="edit", conditions=dict(method=["GET"],
126 function=check_repo))
126 function=check_repo))
127 m.connect("repo", "/repos/{repo_name:.*?}",
127 m.connect("repo", "/repos/{repo_name:.*?}",
128 action="show", conditions=dict(method=["GET"],
128 action="show", conditions=dict(method=["GET"],
129 function=check_repo))
129 function=check_repo))
130 m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}",
130 m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}",
131 action="show", conditions=dict(method=["GET"],
131 action="show", conditions=dict(method=["GET"],
132 function=check_repo))
132 function=check_repo))
133 #add repo perm member
133 #add repo perm member
134 m.connect('set_repo_perm_member',
134 m.connect('set_repo_perm_member',
135 "/repos/{repo_name:.*?}/grant_perm",
135 "/repos/{repo_name:.*?}/grant_perm",
136 action="set_repo_perm_member",
136 action="set_repo_perm_member",
137 conditions=dict(method=["POST"], function=check_repo))
137 conditions=dict(method=["POST"], function=check_repo))
138
138
139 #ajax delete repo perm user
139 #ajax delete repo perm user
140 m.connect('delete_repo_perm_member',
140 m.connect('delete_repo_perm_member',
141 "/repos/{repo_name:.*?}/revoke_perm",
141 "/repos/{repo_name:.*?}/revoke_perm",
142 action="delete_repo_perm_member",
142 action="delete_repo_perm_member",
143 conditions=dict(method=["DELETE"], function=check_repo))
143 conditions=dict(method=["DELETE"], function=check_repo))
144
144
145 #settings actions
145 #settings actions
146 m.connect('repo_stats', "/repos_stats/{repo_name:.*?}",
146 m.connect('repo_stats', "/repos_stats/{repo_name:.*?}",
147 action="repo_stats", conditions=dict(method=["DELETE"],
147 action="repo_stats", conditions=dict(method=["DELETE"],
148 function=check_repo))
148 function=check_repo))
149 m.connect('repo_cache', "/repos_cache/{repo_name:.*?}",
149 m.connect('repo_cache', "/repos_cache/{repo_name:.*?}",
150 action="repo_cache", conditions=dict(method=["DELETE"],
150 action="repo_cache", conditions=dict(method=["DELETE"],
151 function=check_repo))
151 function=check_repo))
152 m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}",
152 m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}",
153 action="repo_public_journal", conditions=dict(method=["PUT"],
153 action="repo_public_journal", conditions=dict(method=["PUT"],
154 function=check_repo))
154 function=check_repo))
155 m.connect('repo_pull', "/repo_pull/{repo_name:.*?}",
155 m.connect('repo_pull', "/repo_pull/{repo_name:.*?}",
156 action="repo_pull", conditions=dict(method=["PUT"],
156 action="repo_pull", conditions=dict(method=["PUT"],
157 function=check_repo))
157 function=check_repo))
158 m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}",
158 m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}",
159 action="repo_as_fork", conditions=dict(method=["PUT"],
159 action="repo_as_fork", conditions=dict(method=["PUT"],
160 function=check_repo))
160 function=check_repo))
161 m.connect('repo_locking', "/repo_locking/{repo_name:.*?}",
161 m.connect('repo_locking', "/repo_locking/{repo_name:.*?}",
162 action="repo_locking", conditions=dict(method=["PUT"],
162 action="repo_locking", conditions=dict(method=["PUT"],
163 function=check_repo))
163 function=check_repo))
164 m.connect('toggle_locking', "/locking_toggle/{repo_name:.*?}",
164 m.connect('toggle_locking', "/locking_toggle/{repo_name:.*?}",
165 action="toggle_locking", conditions=dict(method=["GET"],
165 action="toggle_locking", conditions=dict(method=["GET"],
166 function=check_repo))
166 function=check_repo))
167
167
168 #repo fields
168 #repo fields
169 m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new",
169 m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new",
170 action="create_repo_field", conditions=dict(method=["PUT"],
170 action="create_repo_field", conditions=dict(method=["PUT"],
171 function=check_repo))
171 function=check_repo))
172
172
173 m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}",
173 m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}",
174 action="delete_repo_field", conditions=dict(method=["DELETE"],
174 action="delete_repo_field", conditions=dict(method=["DELETE"],
175 function=check_repo))
175 function=check_repo))
176
176
177 with rmap.submapper(path_prefix=ADMIN_PREFIX,
177 with rmap.submapper(path_prefix=ADMIN_PREFIX,
178 controller='admin/repos_groups') as m:
178 controller='admin/repos_groups') as m:
179 m.connect("repos_groups", "/repos_groups",
179 m.connect("repos_groups", "/repos_groups",
180 action="create", conditions=dict(method=["POST"]))
180 action="create", conditions=dict(method=["POST"]))
181 m.connect("repos_groups", "/repos_groups",
181 m.connect("repos_groups", "/repos_groups",
182 action="index", conditions=dict(method=["GET"]))
182 action="index", conditions=dict(method=["GET"]))
183 m.connect("formatted_repos_groups", "/repos_groups.{format}",
183 m.connect("formatted_repos_groups", "/repos_groups.{format}",
184 action="index", conditions=dict(method=["GET"]))
184 action="index", conditions=dict(method=["GET"]))
185 m.connect("new_repos_group", "/repos_groups/new",
185 m.connect("new_repos_group", "/repos_groups/new",
186 action="new", conditions=dict(method=["GET"]))
186 action="new", conditions=dict(method=["GET"]))
187 m.connect("formatted_new_repos_group", "/repos_groups/new.{format}",
187 m.connect("formatted_new_repos_group", "/repos_groups/new.{format}",
188 action="new", conditions=dict(method=["GET"]))
188 action="new", conditions=dict(method=["GET"]))
189 m.connect("update_repos_group", "/repos_groups/{group_name:.*?}",
189 m.connect("update_repos_group", "/repos_groups/{group_name:.*?}",
190 action="update", conditions=dict(method=["PUT"],
190 action="update", conditions=dict(method=["PUT"],
191 function=check_group))
191 function=check_group))
192 #add repo group perm member
192 #add repo group perm member
193 m.connect('set_repo_group_perm_member',
193 m.connect('set_repo_group_perm_member',
194 "/repos_groups/{group_name:.*?}/grant_perm",
194 "/repos_groups/{group_name:.*?}/grant_perm",
195 action="set_repo_group_perm_member",
195 action="set_repo_group_perm_member",
196 conditions=dict(method=["POST"], function=check_group))
196 conditions=dict(method=["POST"], function=check_group))
197
197
198 #ajax delete repo group perm
198 #ajax delete repo group perm
199 m.connect('delete_repo_group_perm_member',
199 m.connect('delete_repo_group_perm_member',
200 "/repos_groups/{group_name:.*?}/revoke_perm",
200 "/repos_groups/{group_name:.*?}/revoke_perm",
201 action="delete_repo_group_perm_member",
201 action="delete_repo_group_perm_member",
202 conditions=dict(method=["DELETE"], function=check_group))
202 conditions=dict(method=["DELETE"], function=check_group))
203
203
204 m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}",
204 m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}",
205 action="delete", conditions=dict(method=["DELETE"],
205 action="delete", conditions=dict(method=["DELETE"],
206 function=check_group_skip_path))
206 function=check_group_skip_path))
207 m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit",
207 m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit",
208 action="edit", conditions=dict(method=["GET"],
208 action="edit", conditions=dict(method=["GET"],
209 function=check_group))
209 function=check_group))
210 m.connect("formatted_edit_repos_group",
210 m.connect("formatted_edit_repos_group",
211 "/repos_groups/{group_name:.*?}.{format}/edit",
211 "/repos_groups/{group_name:.*?}.{format}/edit",
212 action="edit", conditions=dict(method=["GET"],
212 action="edit", conditions=dict(method=["GET"],
213 function=check_group))
213 function=check_group))
214 m.connect("repos_group", "/repos_groups/{group_name:.*?}",
214 m.connect("repos_group", "/repos_groups/{group_name:.*?}",
215 action="show", conditions=dict(method=["GET"],
215 action="show", conditions=dict(method=["GET"],
216 function=check_group))
216 function=check_group))
217 m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}",
217 m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}",
218 action="show", conditions=dict(method=["GET"],
218 action="show", conditions=dict(method=["GET"],
219 function=check_group))
219 function=check_group))
220
220
221 #ADMIN USER REST ROUTES
221 #ADMIN USER REST ROUTES
222 with rmap.submapper(path_prefix=ADMIN_PREFIX,
222 with rmap.submapper(path_prefix=ADMIN_PREFIX,
223 controller='admin/users') as m:
223 controller='admin/users') as m:
224 m.connect("users", "/users",
224 m.connect("users", "/users",
225 action="create", conditions=dict(method=["POST"]))
225 action="create", conditions=dict(method=["POST"]))
226 m.connect("users", "/users",
226 m.connect("users", "/users",
227 action="index", conditions=dict(method=["GET"]))
227 action="index", conditions=dict(method=["GET"]))
228 m.connect("formatted_users", "/users.{format}",
228 m.connect("formatted_users", "/users.{format}",
229 action="index", conditions=dict(method=["GET"]))
229 action="index", conditions=dict(method=["GET"]))
230 m.connect("new_user", "/users/new",
230 m.connect("new_user", "/users/new",
231 action="new", conditions=dict(method=["GET"]))
231 action="new", conditions=dict(method=["GET"]))
232 m.connect("formatted_new_user", "/users/new.{format}",
232 m.connect("formatted_new_user", "/users/new.{format}",
233 action="new", conditions=dict(method=["GET"]))
233 action="new", conditions=dict(method=["GET"]))
234 m.connect("update_user", "/users/{id}",
234 m.connect("update_user", "/users/{id}",
235 action="update", conditions=dict(method=["PUT"]))
235 action="update", conditions=dict(method=["PUT"]))
236 m.connect("delete_user", "/users/{id}",
236 m.connect("delete_user", "/users/{id}",
237 action="delete", conditions=dict(method=["DELETE"]))
237 action="delete", conditions=dict(method=["DELETE"]))
238 m.connect("edit_user", "/users/{id}/edit",
238 m.connect("edit_user", "/users/{id}/edit",
239 action="edit", conditions=dict(method=["GET"]))
239 action="edit", conditions=dict(method=["GET"]))
240 m.connect("formatted_edit_user",
240 m.connect("formatted_edit_user",
241 "/users/{id}.{format}/edit",
241 "/users/{id}.{format}/edit",
242 action="edit", conditions=dict(method=["GET"]))
242 action="edit", conditions=dict(method=["GET"]))
243 m.connect("user", "/users/{id}",
243 m.connect("user", "/users/{id}",
244 action="show", conditions=dict(method=["GET"]))
244 action="show", conditions=dict(method=["GET"]))
245 m.connect("formatted_user", "/users/{id}.{format}",
245 m.connect("formatted_user", "/users/{id}.{format}",
246 action="show", conditions=dict(method=["GET"]))
246 action="show", conditions=dict(method=["GET"]))
247
247
248 #EXTRAS USER ROUTES
248 #EXTRAS USER ROUTES
249 m.connect("user_perm", "/users_perm/{id}",
249 m.connect("user_perm", "/users_perm/{id}",
250 action="update_perm", conditions=dict(method=["PUT"]))
250 action="update_perm", conditions=dict(method=["PUT"]))
251 m.connect("user_emails", "/users_emails/{id}",
251 m.connect("user_emails", "/users_emails/{id}",
252 action="add_email", conditions=dict(method=["PUT"]))
252 action="add_email", conditions=dict(method=["PUT"]))
253 m.connect("user_emails_delete", "/users_emails/{id}",
253 m.connect("user_emails_delete", "/users_emails/{id}",
254 action="delete_email", conditions=dict(method=["DELETE"]))
254 action="delete_email", conditions=dict(method=["DELETE"]))
255 m.connect("user_ips", "/users_ips/{id}",
255 m.connect("user_ips", "/users_ips/{id}",
256 action="add_ip", conditions=dict(method=["PUT"]))
256 action="add_ip", conditions=dict(method=["PUT"]))
257 m.connect("user_ips_delete", "/users_ips/{id}",
257 m.connect("user_ips_delete", "/users_ips/{id}",
258 action="delete_ip", conditions=dict(method=["DELETE"]))
258 action="delete_ip", conditions=dict(method=["DELETE"]))
259
259
260 #ADMIN USER GROUPS REST ROUTES
260 #ADMIN USER GROUPS REST ROUTES
261 with rmap.submapper(path_prefix=ADMIN_PREFIX,
261 with rmap.submapper(path_prefix=ADMIN_PREFIX,
262 controller='admin/users_groups') as m:
262 controller='admin/users_groups') as m:
263 m.connect("users_groups", "/users_groups",
263 m.connect("users_groups", "/users_groups",
264 action="create", conditions=dict(method=["POST"]))
264 action="create", conditions=dict(method=["POST"]))
265 m.connect("users_groups", "/users_groups",
265 m.connect("users_groups", "/users_groups",
266 action="index", conditions=dict(method=["GET"]))
266 action="index", conditions=dict(method=["GET"]))
267 m.connect("formatted_users_groups", "/users_groups.{format}",
267 m.connect("formatted_users_groups", "/users_groups.{format}",
268 action="index", conditions=dict(method=["GET"]))
268 action="index", conditions=dict(method=["GET"]))
269 m.connect("new_users_group", "/users_groups/new",
269 m.connect("new_users_group", "/users_groups/new",
270 action="new", conditions=dict(method=["GET"]))
270 action="new", conditions=dict(method=["GET"]))
271 m.connect("formatted_new_users_group", "/users_groups/new.{format}",
271 m.connect("formatted_new_users_group", "/users_groups/new.{format}",
272 action="new", conditions=dict(method=["GET"]))
272 action="new", conditions=dict(method=["GET"]))
273 m.connect("update_users_group", "/users_groups/{id}",
273 m.connect("update_users_group", "/users_groups/{id}",
274 action="update", conditions=dict(method=["PUT"]))
274 action="update", conditions=dict(method=["PUT"]))
275 m.connect("delete_users_group", "/users_groups/{id}",
275 m.connect("delete_users_group", "/users_groups/{id}",
276 action="delete", conditions=dict(method=["DELETE"]))
276 action="delete", conditions=dict(method=["DELETE"]))
277 m.connect("edit_users_group", "/users_groups/{id}/edit",
277 m.connect("edit_users_group", "/users_groups/{id}/edit",
278 action="edit", conditions=dict(method=["GET"]),
278 action="edit", conditions=dict(method=["GET"]),
279 function=check_user_group)
279 function=check_user_group)
280 m.connect("formatted_edit_users_group",
280 m.connect("formatted_edit_users_group",
281 "/users_groups/{id}.{format}/edit",
281 "/users_groups/{id}.{format}/edit",
282 action="edit", conditions=dict(method=["GET"]))
282 action="edit", conditions=dict(method=["GET"]))
283 m.connect("users_group", "/users_groups/{id}",
283 m.connect("users_group", "/users_groups/{id}",
284 action="show", conditions=dict(method=["GET"]))
284 action="show", conditions=dict(method=["GET"]))
285 m.connect("formatted_users_group", "/users_groups/{id}.{format}",
285 m.connect("formatted_users_group", "/users_groups/{id}.{format}",
286 action="show", conditions=dict(method=["GET"]))
286 action="show", conditions=dict(method=["GET"]))
287
287
288 #EXTRAS USER ROUTES
288 #EXTRAS USER ROUTES
289 # update
289 # update
290 m.connect("users_group_perm", "/users_groups/{id}/update_global_perm",
290 m.connect("users_group_perm", "/users_groups/{id}/update_global_perm",
291 action="update_perm", conditions=dict(method=["PUT"]))
291 action="update_perm", conditions=dict(method=["PUT"]))
292
292
293 #add user group perm member
293 #add user group perm member
294 m.connect('set_user_group_perm_member', "/users_groups/{id}/grant_perm",
294 m.connect('set_user_group_perm_member', "/users_groups/{id}/grant_perm",
295 action="set_user_group_perm_member",
295 action="set_user_group_perm_member",
296 conditions=dict(method=["POST"]))
296 conditions=dict(method=["POST"]))
297
297
298 #ajax delete user group perm
298 #ajax delete user group perm
299 m.connect('delete_user_group_perm_member', "/users_groups/{id}/revoke_perm",
299 m.connect('delete_user_group_perm_member', "/users_groups/{id}/revoke_perm",
300 action="delete_user_group_perm_member",
300 action="delete_user_group_perm_member",
301 conditions=dict(method=["DELETE"]))
301 conditions=dict(method=["DELETE"]))
302
302
303 #ADMIN GROUP REST ROUTES
303 #ADMIN GROUP REST ROUTES
304 rmap.resource('group', 'groups',
304 rmap.resource('group', 'groups',
305 controller='admin/groups', path_prefix=ADMIN_PREFIX)
305 controller='admin/groups', path_prefix=ADMIN_PREFIX)
306
306
307 #ADMIN PERMISSIONS REST ROUTES
307 #ADMIN PERMISSIONS REST ROUTES
308 rmap.resource('permission', 'permissions',
308 rmap.resource('permission', 'permissions',
309 controller='admin/permissions', path_prefix=ADMIN_PREFIX)
309 controller='admin/permissions', path_prefix=ADMIN_PREFIX)
310
310
311 #ADMIN DEFAULTS REST ROUTES
311 #ADMIN DEFAULTS REST ROUTES
312 rmap.resource('default', 'defaults',
312 rmap.resource('default', 'defaults',
313 controller='admin/defaults', path_prefix=ADMIN_PREFIX)
313 controller='admin/defaults', path_prefix=ADMIN_PREFIX)
314
314
315 ##ADMIN LDAP SETTINGS
315 ##ADMIN LDAP SETTINGS
316 rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX,
316 rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX,
317 controller='admin/ldap_settings', action='ldap_settings',
317 controller='admin/ldap_settings', action='ldap_settings',
318 conditions=dict(method=["POST"]))
318 conditions=dict(method=["POST"]))
319
319
320 rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX,
320 rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX,
321 controller='admin/ldap_settings')
321 controller='admin/ldap_settings')
322
322
323 #ADMIN SETTINGS REST ROUTES
323 #ADMIN SETTINGS REST ROUTES
324 with rmap.submapper(path_prefix=ADMIN_PREFIX,
324 with rmap.submapper(path_prefix=ADMIN_PREFIX,
325 controller='admin/settings') as m:
325 controller='admin/settings') as m:
326 m.connect("admin_settings", "/settings",
326 m.connect("admin_settings", "/settings",
327 action="create", conditions=dict(method=["POST"]))
327 action="create", conditions=dict(method=["POST"]))
328 m.connect("admin_settings", "/settings",
328 m.connect("admin_settings", "/settings",
329 action="index", conditions=dict(method=["GET"]))
329 action="index", conditions=dict(method=["GET"]))
330 m.connect("formatted_admin_settings", "/settings.{format}",
330 m.connect("formatted_admin_settings", "/settings.{format}",
331 action="index", conditions=dict(method=["GET"]))
331 action="index", conditions=dict(method=["GET"]))
332 m.connect("admin_new_setting", "/settings/new",
332 m.connect("admin_new_setting", "/settings/new",
333 action="new", conditions=dict(method=["GET"]))
333 action="new", conditions=dict(method=["GET"]))
334 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
334 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
335 action="new", conditions=dict(method=["GET"]))
335 action="new", conditions=dict(method=["GET"]))
336 m.connect("/settings/{setting_id}",
336 m.connect("/settings/{setting_id}",
337 action="update", conditions=dict(method=["PUT"]))
337 action="update", conditions=dict(method=["PUT"]))
338 m.connect("/settings/{setting_id}",
338 m.connect("/settings/{setting_id}",
339 action="delete", conditions=dict(method=["DELETE"]))
339 action="delete", conditions=dict(method=["DELETE"]))
340 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
340 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
341 action="edit", conditions=dict(method=["GET"]))
341 action="edit", conditions=dict(method=["GET"]))
342 m.connect("formatted_admin_edit_setting",
342 m.connect("formatted_admin_edit_setting",
343 "/settings/{setting_id}.{format}/edit",
343 "/settings/{setting_id}.{format}/edit",
344 action="edit", conditions=dict(method=["GET"]))
344 action="edit", conditions=dict(method=["GET"]))
345 m.connect("admin_setting", "/settings/{setting_id}",
345 m.connect("admin_setting", "/settings/{setting_id}",
346 action="show", conditions=dict(method=["GET"]))
346 action="show", conditions=dict(method=["GET"]))
347 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
347 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
348 action="show", conditions=dict(method=["GET"]))
348 action="show", conditions=dict(method=["GET"]))
349 m.connect("admin_settings_my_account", "/my_account",
349 m.connect("admin_settings_my_account", "/my_account",
350 action="my_account", conditions=dict(method=["GET"]))
350 action="my_account", conditions=dict(method=["GET"]))
351 m.connect("admin_settings_my_account_update", "/my_account_update",
351 m.connect("admin_settings_my_account_update", "/my_account_update",
352 action="my_account_update", conditions=dict(method=["PUT"]))
352 action="my_account_update", conditions=dict(method=["PUT"]))
353 m.connect("admin_settings_my_repos", "/my_account/repos",
353 m.connect("admin_settings_my_repos", "/my_account/repos",
354 action="my_account_my_repos", conditions=dict(method=["GET"]))
354 action="my_account_my_repos", conditions=dict(method=["GET"]))
355 m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests",
355 m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests",
356 action="my_account_my_pullrequests", conditions=dict(method=["GET"]))
356 action="my_account_my_pullrequests", conditions=dict(method=["GET"]))
357
357
358 #NOTIFICATION REST ROUTES
358 #NOTIFICATION REST ROUTES
359 with rmap.submapper(path_prefix=ADMIN_PREFIX,
359 with rmap.submapper(path_prefix=ADMIN_PREFIX,
360 controller='admin/notifications') as m:
360 controller='admin/notifications') as m:
361 m.connect("notifications", "/notifications",
361 m.connect("notifications", "/notifications",
362 action="create", conditions=dict(method=["POST"]))
362 action="create", conditions=dict(method=["POST"]))
363 m.connect("notifications", "/notifications",
363 m.connect("notifications", "/notifications",
364 action="index", conditions=dict(method=["GET"]))
364 action="index", conditions=dict(method=["GET"]))
365 m.connect("notifications_mark_all_read", "/notifications/mark_all_read",
365 m.connect("notifications_mark_all_read", "/notifications/mark_all_read",
366 action="mark_all_read", conditions=dict(method=["GET"]))
366 action="mark_all_read", conditions=dict(method=["GET"]))
367 m.connect("formatted_notifications", "/notifications.{format}",
367 m.connect("formatted_notifications", "/notifications.{format}",
368 action="index", conditions=dict(method=["GET"]))
368 action="index", conditions=dict(method=["GET"]))
369 m.connect("new_notification", "/notifications/new",
369 m.connect("new_notification", "/notifications/new",
370 action="new", conditions=dict(method=["GET"]))
370 action="new", conditions=dict(method=["GET"]))
371 m.connect("formatted_new_notification", "/notifications/new.{format}",
371 m.connect("formatted_new_notification", "/notifications/new.{format}",
372 action="new", conditions=dict(method=["GET"]))
372 action="new", conditions=dict(method=["GET"]))
373 m.connect("/notification/{notification_id}",
373 m.connect("/notification/{notification_id}",
374 action="update", conditions=dict(method=["PUT"]))
374 action="update", conditions=dict(method=["PUT"]))
375 m.connect("/notification/{notification_id}",
375 m.connect("/notification/{notification_id}",
376 action="delete", conditions=dict(method=["DELETE"]))
376 action="delete", conditions=dict(method=["DELETE"]))
377 m.connect("edit_notification", "/notification/{notification_id}/edit",
377 m.connect("edit_notification", "/notification/{notification_id}/edit",
378 action="edit", conditions=dict(method=["GET"]))
378 action="edit", conditions=dict(method=["GET"]))
379 m.connect("formatted_edit_notification",
379 m.connect("formatted_edit_notification",
380 "/notification/{notification_id}.{format}/edit",
380 "/notification/{notification_id}.{format}/edit",
381 action="edit", conditions=dict(method=["GET"]))
381 action="edit", conditions=dict(method=["GET"]))
382 m.connect("notification", "/notification/{notification_id}",
382 m.connect("notification", "/notification/{notification_id}",
383 action="show", conditions=dict(method=["GET"]))
383 action="show", conditions=dict(method=["GET"]))
384 m.connect("formatted_notification", "/notification/{notification_id}.{format}",
384 m.connect("formatted_notification", "/notification/{notification_id}.{format}",
385 action="show", conditions=dict(method=["GET"]))
385 action="show", conditions=dict(method=["GET"]))
386
386
387 #ADMIN GIST
387 #ADMIN GIST
388 with rmap.submapper(path_prefix=ADMIN_PREFIX,
388 with rmap.submapper(path_prefix=ADMIN_PREFIX,
389 controller='admin/gists') as m:
389 controller='admin/gists') as m:
390 m.connect("gists", "/gists",
390 m.connect("gists", "/gists",
391 action="create", conditions=dict(method=["POST"]))
391 action="create", conditions=dict(method=["POST"]))
392 m.connect("gists", "/gists",
392 m.connect("gists", "/gists",
393 action="index", conditions=dict(method=["GET"]))
393 action="index", conditions=dict(method=["GET"]))
394 m.connect("formatted_gists", "/gists/{format}",
395 action="index", conditions=dict(method=["GET"]))
396 m.connect("new_gist", "/gists/new",
394 m.connect("new_gist", "/gists/new",
397 action="new", conditions=dict(method=["GET"]))
395 action="new", conditions=dict(method=["GET"]))
398 m.connect("formatted_new_gist", "/gists/new/{format}",
396 m.connect("formatted_new_gist", "/gists/new/{format}",
399 action="new", conditions=dict(method=["GET"]))
397 action="new", conditions=dict(method=["GET"]))
398 m.connect("formatted_gists", "/gists/{format}",
399 action="index", conditions=dict(method=["GET"]))
400 m.connect("/gist/{gist_id}",
400 m.connect("/gist/{gist_id}",
401 action="update", conditions=dict(method=["PUT"]))
401 action="update", conditions=dict(method=["PUT"]))
402 m.connect("/gist/{gist_id}",
402 m.connect("/gist/{gist_id}",
403 action="delete", conditions=dict(method=["DELETE"]))
403 action="delete", conditions=dict(method=["DELETE"]))
404 m.connect("edit_gist", "/gist/{gist_id}/edit",
404 m.connect("edit_gist", "/gist/{gist_id}/edit",
405 action="edit", conditions=dict(method=["GET"]))
405 action="edit", conditions=dict(method=["GET"]))
406 m.connect("formatted_edit_gist",
406 m.connect("formatted_edit_gist",
407 "/gist/{gist_id}/{format}/edit",
407 "/gist/{gist_id}/{format}/edit",
408 action="edit", conditions=dict(method=["GET"]))
408 action="edit", conditions=dict(method=["GET"]))
409 m.connect("gist", "/gist/{gist_id}",
409 m.connect("gist", "/gist/{gist_id}",
410 action="show", conditions=dict(method=["GET"]))
410 action="show", conditions=dict(method=["GET"]))
411 m.connect("formatted_gist", "/gist/{gist_id}/{format}",
411 m.connect("formatted_gist", "/gist/{gist_id}/{format}",
412 action="show", conditions=dict(method=["GET"]))
412 action="show", conditions=dict(method=["GET"]))
413 m.connect("formatted_gist_file", "/gist/{gist_id}/{format}/{revision}/{f_path:.*}",
413 m.connect("formatted_gist_file", "/gist/{gist_id}/{format}/{revision}/{f_path:.*}",
414 action="show", conditions=dict(method=["GET"]))
414 action="show", conditions=dict(method=["GET"]))
415
415
416 #ADMIN MAIN PAGES
416 #ADMIN MAIN PAGES
417 with rmap.submapper(path_prefix=ADMIN_PREFIX,
417 with rmap.submapper(path_prefix=ADMIN_PREFIX,
418 controller='admin/admin') as m:
418 controller='admin/admin') as m:
419 m.connect('admin_home', '', action='index')
419 m.connect('admin_home', '', action='index')
420 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
420 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
421 action='add_repo')
421 action='add_repo')
422 #==========================================================================
422 #==========================================================================
423 # API V2
423 # API V2
424 #==========================================================================
424 #==========================================================================
425 with rmap.submapper(path_prefix=ADMIN_PREFIX,
425 with rmap.submapper(path_prefix=ADMIN_PREFIX,
426 controller='api/api') as m:
426 controller='api/api') as m:
427 m.connect('api', '/api')
427 m.connect('api', '/api')
428
428
429 #USER JOURNAL
429 #USER JOURNAL
430 rmap.connect('journal', '%s/journal' % ADMIN_PREFIX,
430 rmap.connect('journal', '%s/journal' % ADMIN_PREFIX,
431 controller='journal', action='index')
431 controller='journal', action='index')
432 rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX,
432 rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX,
433 controller='journal', action='journal_rss')
433 controller='journal', action='journal_rss')
434 rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX,
434 rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX,
435 controller='journal', action='journal_atom')
435 controller='journal', action='journal_atom')
436
436
437 rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX,
437 rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX,
438 controller='journal', action="public_journal")
438 controller='journal', action="public_journal")
439
439
440 rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX,
440 rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX,
441 controller='journal', action="public_journal_rss")
441 controller='journal', action="public_journal_rss")
442
442
443 rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX,
443 rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX,
444 controller='journal', action="public_journal_rss")
444 controller='journal', action="public_journal_rss")
445
445
446 rmap.connect('public_journal_atom',
446 rmap.connect('public_journal_atom',
447 '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal',
447 '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal',
448 action="public_journal_atom")
448 action="public_journal_atom")
449
449
450 rmap.connect('public_journal_atom_old',
450 rmap.connect('public_journal_atom_old',
451 '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal',
451 '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal',
452 action="public_journal_atom")
452 action="public_journal_atom")
453
453
454 rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX,
454 rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX,
455 controller='journal', action='toggle_following',
455 controller='journal', action='toggle_following',
456 conditions=dict(method=["POST"]))
456 conditions=dict(method=["POST"]))
457
457
458 #SEARCH
458 #SEARCH
459 rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',)
459 rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',)
460 rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX,
460 rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX,
461 controller='search',
461 controller='search',
462 conditions=dict(function=check_repo))
462 conditions=dict(function=check_repo))
463 rmap.connect('search_repo', '/{repo_name:.*?}/search',
463 rmap.connect('search_repo', '/{repo_name:.*?}/search',
464 controller='search',
464 controller='search',
465 conditions=dict(function=check_repo),
465 conditions=dict(function=check_repo),
466 )
466 )
467
467
468 #LOGIN/LOGOUT/REGISTER/SIGN IN
468 #LOGIN/LOGOUT/REGISTER/SIGN IN
469 rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login')
469 rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login')
470 rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login',
470 rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login',
471 action='logout')
471 action='logout')
472
472
473 rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login',
473 rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login',
474 action='register')
474 action='register')
475
475
476 rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX,
476 rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX,
477 controller='login', action='password_reset')
477 controller='login', action='password_reset')
478
478
479 rmap.connect('reset_password_confirmation',
479 rmap.connect('reset_password_confirmation',
480 '%s/password_reset_confirmation' % ADMIN_PREFIX,
480 '%s/password_reset_confirmation' % ADMIN_PREFIX,
481 controller='login', action='password_reset_confirmation')
481 controller='login', action='password_reset_confirmation')
482
482
483 #FEEDS
483 #FEEDS
484 rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss',
484 rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss',
485 controller='feed', action='rss',
485 controller='feed', action='rss',
486 conditions=dict(function=check_repo))
486 conditions=dict(function=check_repo))
487
487
488 rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom',
488 rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom',
489 controller='feed', action='atom',
489 controller='feed', action='atom',
490 conditions=dict(function=check_repo))
490 conditions=dict(function=check_repo))
491
491
492 #==========================================================================
492 #==========================================================================
493 # REPOSITORY ROUTES
493 # REPOSITORY ROUTES
494 #==========================================================================
494 #==========================================================================
495 rmap.connect('summary_home', '/{repo_name:.*?}',
495 rmap.connect('summary_home', '/{repo_name:.*?}',
496 controller='summary',
496 controller='summary',
497 conditions=dict(function=check_repo))
497 conditions=dict(function=check_repo))
498
498
499 rmap.connect('repo_size', '/{repo_name:.*?}/repo_size',
499 rmap.connect('repo_size', '/{repo_name:.*?}/repo_size',
500 controller='summary', action='repo_size',
500 controller='summary', action='repo_size',
501 conditions=dict(function=check_repo))
501 conditions=dict(function=check_repo))
502
502
503 rmap.connect('repos_group_home', '/{group_name:.*}',
503 rmap.connect('repos_group_home', '/{group_name:.*}',
504 controller='admin/repos_groups', action="show_by_name",
504 controller='admin/repos_groups', action="show_by_name",
505 conditions=dict(function=check_group))
505 conditions=dict(function=check_group))
506
506
507 rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}',
507 rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}',
508 controller='changeset', revision='tip',
508 controller='changeset', revision='tip',
509 conditions=dict(function=check_repo))
509 conditions=dict(function=check_repo))
510
510
511 # no longer user, but kept for routes to work
511 # no longer user, but kept for routes to work
512 rmap.connect("_edit_repo", "/{repo_name:.*?}/edit",
512 rmap.connect("_edit_repo", "/{repo_name:.*?}/edit",
513 controller='admin/repos', action="edit",
513 controller='admin/repos', action="edit",
514 conditions=dict(method=["GET"], function=check_repo)
514 conditions=dict(method=["GET"], function=check_repo)
515 )
515 )
516
516
517 rmap.connect("edit_repo", "/{repo_name:.*?}/settings",
517 rmap.connect("edit_repo", "/{repo_name:.*?}/settings",
518 controller='admin/repos', action="edit",
518 controller='admin/repos', action="edit",
519 conditions=dict(method=["GET"], function=check_repo)
519 conditions=dict(method=["GET"], function=check_repo)
520 )
520 )
521
521
522 #still working url for backward compat.
522 #still working url for backward compat.
523 rmap.connect('raw_changeset_home_depraced',
523 rmap.connect('raw_changeset_home_depraced',
524 '/{repo_name:.*?}/raw-changeset/{revision}',
524 '/{repo_name:.*?}/raw-changeset/{revision}',
525 controller='changeset', action='changeset_raw',
525 controller='changeset', action='changeset_raw',
526 revision='tip', conditions=dict(function=check_repo))
526 revision='tip', conditions=dict(function=check_repo))
527
527
528 ## new URLs
528 ## new URLs
529 rmap.connect('changeset_raw_home',
529 rmap.connect('changeset_raw_home',
530 '/{repo_name:.*?}/changeset-diff/{revision}',
530 '/{repo_name:.*?}/changeset-diff/{revision}',
531 controller='changeset', action='changeset_raw',
531 controller='changeset', action='changeset_raw',
532 revision='tip', conditions=dict(function=check_repo))
532 revision='tip', conditions=dict(function=check_repo))
533
533
534 rmap.connect('changeset_patch_home',
534 rmap.connect('changeset_patch_home',
535 '/{repo_name:.*?}/changeset-patch/{revision}',
535 '/{repo_name:.*?}/changeset-patch/{revision}',
536 controller='changeset', action='changeset_patch',
536 controller='changeset', action='changeset_patch',
537 revision='tip', conditions=dict(function=check_repo))
537 revision='tip', conditions=dict(function=check_repo))
538
538
539 rmap.connect('changeset_download_home',
539 rmap.connect('changeset_download_home',
540 '/{repo_name:.*?}/changeset-download/{revision}',
540 '/{repo_name:.*?}/changeset-download/{revision}',
541 controller='changeset', action='changeset_download',
541 controller='changeset', action='changeset_download',
542 revision='tip', conditions=dict(function=check_repo))
542 revision='tip', conditions=dict(function=check_repo))
543
543
544 rmap.connect('changeset_comment',
544 rmap.connect('changeset_comment',
545 '/{repo_name:.*?}/changeset/{revision}/comment',
545 '/{repo_name:.*?}/changeset/{revision}/comment',
546 controller='changeset', revision='tip', action='comment',
546 controller='changeset', revision='tip', action='comment',
547 conditions=dict(function=check_repo))
547 conditions=dict(function=check_repo))
548
548
549 rmap.connect('changeset_comment_preview',
549 rmap.connect('changeset_comment_preview',
550 '/{repo_name:.*?}/changeset/comment/preview',
550 '/{repo_name:.*?}/changeset/comment/preview',
551 controller='changeset', action='preview_comment',
551 controller='changeset', action='preview_comment',
552 conditions=dict(function=check_repo, method=["POST"]))
552 conditions=dict(function=check_repo, method=["POST"]))
553
553
554 rmap.connect('changeset_comment_delete',
554 rmap.connect('changeset_comment_delete',
555 '/{repo_name:.*?}/changeset/comment/{comment_id}/delete',
555 '/{repo_name:.*?}/changeset/comment/{comment_id}/delete',
556 controller='changeset', action='delete_comment',
556 controller='changeset', action='delete_comment',
557 conditions=dict(function=check_repo, method=["DELETE"]))
557 conditions=dict(function=check_repo, method=["DELETE"]))
558
558
559 rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}',
559 rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}',
560 controller='changeset', action='changeset_info')
560 controller='changeset', action='changeset_info')
561
561
562 rmap.connect('compare_url',
562 rmap.connect('compare_url',
563 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}',
563 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}',
564 controller='compare', action='index',
564 controller='compare', action='index',
565 conditions=dict(function=check_repo),
565 conditions=dict(function=check_repo),
566 requirements=dict(
566 requirements=dict(
567 org_ref_type='(branch|book|tag|rev|__other_ref_type__)',
567 org_ref_type='(branch|book|tag|rev|__other_ref_type__)',
568 other_ref_type='(branch|book|tag|rev|__org_ref_type__)')
568 other_ref_type='(branch|book|tag|rev|__org_ref_type__)')
569 )
569 )
570
570
571 rmap.connect('pullrequest_home',
571 rmap.connect('pullrequest_home',
572 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
572 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
573 action='index', conditions=dict(function=check_repo,
573 action='index', conditions=dict(function=check_repo,
574 method=["GET"]))
574 method=["GET"]))
575
575
576 rmap.connect('pullrequest',
576 rmap.connect('pullrequest',
577 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
577 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
578 action='create', conditions=dict(function=check_repo,
578 action='create', conditions=dict(function=check_repo,
579 method=["POST"]))
579 method=["POST"]))
580
580
581 rmap.connect('pullrequest_show',
581 rmap.connect('pullrequest_show',
582 '/{repo_name:.*?}/pull-request/{pull_request_id}',
582 '/{repo_name:.*?}/pull-request/{pull_request_id}',
583 controller='pullrequests',
583 controller='pullrequests',
584 action='show', conditions=dict(function=check_repo,
584 action='show', conditions=dict(function=check_repo,
585 method=["GET"]))
585 method=["GET"]))
586 rmap.connect('pullrequest_update',
586 rmap.connect('pullrequest_update',
587 '/{repo_name:.*?}/pull-request/{pull_request_id}',
587 '/{repo_name:.*?}/pull-request/{pull_request_id}',
588 controller='pullrequests',
588 controller='pullrequests',
589 action='update', conditions=dict(function=check_repo,
589 action='update', conditions=dict(function=check_repo,
590 method=["PUT"]))
590 method=["PUT"]))
591 rmap.connect('pullrequest_delete',
591 rmap.connect('pullrequest_delete',
592 '/{repo_name:.*?}/pull-request/{pull_request_id}',
592 '/{repo_name:.*?}/pull-request/{pull_request_id}',
593 controller='pullrequests',
593 controller='pullrequests',
594 action='delete', conditions=dict(function=check_repo,
594 action='delete', conditions=dict(function=check_repo,
595 method=["DELETE"]))
595 method=["DELETE"]))
596
596
597 rmap.connect('pullrequest_show_all',
597 rmap.connect('pullrequest_show_all',
598 '/{repo_name:.*?}/pull-request',
598 '/{repo_name:.*?}/pull-request',
599 controller='pullrequests',
599 controller='pullrequests',
600 action='show_all', conditions=dict(function=check_repo,
600 action='show_all', conditions=dict(function=check_repo,
601 method=["GET"]))
601 method=["GET"]))
602
602
603 rmap.connect('pullrequest_comment',
603 rmap.connect('pullrequest_comment',
604 '/{repo_name:.*?}/pull-request-comment/{pull_request_id}',
604 '/{repo_name:.*?}/pull-request-comment/{pull_request_id}',
605 controller='pullrequests',
605 controller='pullrequests',
606 action='comment', conditions=dict(function=check_repo,
606 action='comment', conditions=dict(function=check_repo,
607 method=["POST"]))
607 method=["POST"]))
608
608
609 rmap.connect('pullrequest_comment_delete',
609 rmap.connect('pullrequest_comment_delete',
610 '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete',
610 '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete',
611 controller='pullrequests', action='delete_comment',
611 controller='pullrequests', action='delete_comment',
612 conditions=dict(function=check_repo, method=["DELETE"]))
612 conditions=dict(function=check_repo, method=["DELETE"]))
613
613
614 rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary',
614 rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary',
615 controller='summary', conditions=dict(function=check_repo))
615 controller='summary', conditions=dict(function=check_repo))
616
616
617 rmap.connect('branches_home', '/{repo_name:.*?}/branches',
617 rmap.connect('branches_home', '/{repo_name:.*?}/branches',
618 controller='branches', conditions=dict(function=check_repo))
618 controller='branches', conditions=dict(function=check_repo))
619
619
620 rmap.connect('tags_home', '/{repo_name:.*?}/tags',
620 rmap.connect('tags_home', '/{repo_name:.*?}/tags',
621 controller='tags', conditions=dict(function=check_repo))
621 controller='tags', conditions=dict(function=check_repo))
622
622
623 rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks',
623 rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks',
624 controller='bookmarks', conditions=dict(function=check_repo))
624 controller='bookmarks', conditions=dict(function=check_repo))
625
625
626 rmap.connect('changelog_home', '/{repo_name:.*?}/changelog',
626 rmap.connect('changelog_home', '/{repo_name:.*?}/changelog',
627 controller='changelog', conditions=dict(function=check_repo))
627 controller='changelog', conditions=dict(function=check_repo))
628
628
629 rmap.connect('changelog_summary_home', '/{repo_name:.*?}/changelog_summary',
629 rmap.connect('changelog_summary_home', '/{repo_name:.*?}/changelog_summary',
630 controller='changelog', action='changelog_summary',
630 controller='changelog', action='changelog_summary',
631 conditions=dict(function=check_repo))
631 conditions=dict(function=check_repo))
632
632
633 rmap.connect('changelog_file_home', '/{repo_name:.*?}/changelog/{revision}/{f_path:.*}',
633 rmap.connect('changelog_file_home', '/{repo_name:.*?}/changelog/{revision}/{f_path:.*}',
634 controller='changelog', f_path=None,
634 controller='changelog', f_path=None,
635 conditions=dict(function=check_repo))
635 conditions=dict(function=check_repo))
636
636
637 rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}',
637 rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}',
638 controller='changelog', action='changelog_details',
638 controller='changelog', action='changelog_details',
639 conditions=dict(function=check_repo))
639 conditions=dict(function=check_repo))
640
640
641 rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}',
641 rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}',
642 controller='files', revision='tip', f_path='',
642 controller='files', revision='tip', f_path='',
643 conditions=dict(function=check_repo))
643 conditions=dict(function=check_repo))
644
644
645 rmap.connect('files_home_nopath', '/{repo_name:.*?}/files/{revision}',
645 rmap.connect('files_home_nopath', '/{repo_name:.*?}/files/{revision}',
646 controller='files', revision='tip', f_path='',
646 controller='files', revision='tip', f_path='',
647 conditions=dict(function=check_repo))
647 conditions=dict(function=check_repo))
648
648
649 rmap.connect('files_history_home',
649 rmap.connect('files_history_home',
650 '/{repo_name:.*?}/history/{revision}/{f_path:.*}',
650 '/{repo_name:.*?}/history/{revision}/{f_path:.*}',
651 controller='files', action='history', revision='tip', f_path='',
651 controller='files', action='history', revision='tip', f_path='',
652 conditions=dict(function=check_repo))
652 conditions=dict(function=check_repo))
653
653
654 rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}',
654 rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}',
655 controller='files', action='diff', revision='tip', f_path='',
655 controller='files', action='diff', revision='tip', f_path='',
656 conditions=dict(function=check_repo))
656 conditions=dict(function=check_repo))
657
657
658 rmap.connect('files_rawfile_home',
658 rmap.connect('files_rawfile_home',
659 '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}',
659 '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}',
660 controller='files', action='rawfile', revision='tip',
660 controller='files', action='rawfile', revision='tip',
661 f_path='', conditions=dict(function=check_repo))
661 f_path='', conditions=dict(function=check_repo))
662
662
663 rmap.connect('files_raw_home',
663 rmap.connect('files_raw_home',
664 '/{repo_name:.*?}/raw/{revision}/{f_path:.*}',
664 '/{repo_name:.*?}/raw/{revision}/{f_path:.*}',
665 controller='files', action='raw', revision='tip', f_path='',
665 controller='files', action='raw', revision='tip', f_path='',
666 conditions=dict(function=check_repo))
666 conditions=dict(function=check_repo))
667
667
668 rmap.connect('files_annotate_home',
668 rmap.connect('files_annotate_home',
669 '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}',
669 '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}',
670 controller='files', action='index', revision='tip',
670 controller='files', action='index', revision='tip',
671 f_path='', annotate=True, conditions=dict(function=check_repo))
671 f_path='', annotate=True, conditions=dict(function=check_repo))
672
672
673 rmap.connect('files_edit_home',
673 rmap.connect('files_edit_home',
674 '/{repo_name:.*?}/edit/{revision}/{f_path:.*}',
674 '/{repo_name:.*?}/edit/{revision}/{f_path:.*}',
675 controller='files', action='edit', revision='tip',
675 controller='files', action='edit', revision='tip',
676 f_path='', conditions=dict(function=check_repo))
676 f_path='', conditions=dict(function=check_repo))
677
677
678 rmap.connect('files_add_home',
678 rmap.connect('files_add_home',
679 '/{repo_name:.*?}/add/{revision}/{f_path:.*}',
679 '/{repo_name:.*?}/add/{revision}/{f_path:.*}',
680 controller='files', action='add', revision='tip',
680 controller='files', action='add', revision='tip',
681 f_path='', conditions=dict(function=check_repo))
681 f_path='', conditions=dict(function=check_repo))
682
682
683 rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}',
683 rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}',
684 controller='files', action='archivefile',
684 controller='files', action='archivefile',
685 conditions=dict(function=check_repo))
685 conditions=dict(function=check_repo))
686
686
687 rmap.connect('files_nodelist_home',
687 rmap.connect('files_nodelist_home',
688 '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}',
688 '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}',
689 controller='files', action='nodelist',
689 controller='files', action='nodelist',
690 conditions=dict(function=check_repo))
690 conditions=dict(function=check_repo))
691
691
692 rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork',
692 rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork',
693 controller='forks', action='fork_create',
693 controller='forks', action='fork_create',
694 conditions=dict(function=check_repo, method=["POST"]))
694 conditions=dict(function=check_repo, method=["POST"]))
695
695
696 rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork',
696 rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork',
697 controller='forks', action='fork',
697 controller='forks', action='fork',
698 conditions=dict(function=check_repo))
698 conditions=dict(function=check_repo))
699
699
700 rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks',
700 rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks',
701 controller='forks', action='forks',
701 controller='forks', action='forks',
702 conditions=dict(function=check_repo))
702 conditions=dict(function=check_repo))
703
703
704 rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers',
704 rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers',
705 controller='followers', action='followers',
705 controller='followers', action='followers',
706 conditions=dict(function=check_repo))
706 conditions=dict(function=check_repo))
707
707
708 return rmap
708 return rmap
General Comments 0
You need to be logged in to leave comments. Login now