Show More
@@ -1,1085 +1,1089 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2016 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 | 22 | Routes configuration |
|
23 | 23 | |
|
24 | 24 | The more specific and detailed routes should be defined first so they |
|
25 | 25 | may take precedent over the more generic routes. For more information |
|
26 | 26 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
27 | 27 | |
|
28 | 28 | IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py |
|
29 | 29 | and _route_name variable which uses some of stored naming here to do redirects. |
|
30 | 30 | """ |
|
31 | 31 | import os |
|
32 | 32 | from routes import Mapper |
|
33 | 33 | |
|
34 | 34 | from rhodecode.config import routing_links |
|
35 | 35 | |
|
36 | 36 | # prefix for non repository related links needs to be prefixed with `/` |
|
37 | 37 | ADMIN_PREFIX = '/_admin' |
|
38 | 38 | |
|
39 | 39 | # Default requirements for URL parts |
|
40 | 40 | URL_NAME_REQUIREMENTS = { |
|
41 | 41 | # group name can have a slash in them, but they must not end with a slash |
|
42 | 42 | 'group_name': r'.*?[^/]', |
|
43 | 43 | # repo names can have a slash in them, but they must not end with a slash |
|
44 | 44 | 'repo_name': r'.*?[^/]', |
|
45 | 45 | # file path eats up everything at the end |
|
46 | 46 | 'f_path': r'.*', |
|
47 | 47 | # reference types |
|
48 | 48 | 'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)', |
|
49 | 49 | 'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)', |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | def make_map(config): |
|
54 | 54 | """Create, configure and return the routes Mapper""" |
|
55 | 55 | rmap = Mapper(directory=config['pylons.paths']['controllers'], |
|
56 | 56 | always_scan=config['debug']) |
|
57 | 57 | rmap.minimization = False |
|
58 | 58 | rmap.explicit = False |
|
59 | 59 | |
|
60 | 60 | from rhodecode.lib.utils2 import str2bool |
|
61 | 61 | from rhodecode.model import repo, repo_group |
|
62 | 62 | |
|
63 | 63 | def check_repo(environ, match_dict): |
|
64 | 64 | """ |
|
65 | 65 | check for valid repository for proper 404 handling |
|
66 | 66 | |
|
67 | 67 | :param environ: |
|
68 | 68 | :param match_dict: |
|
69 | 69 | """ |
|
70 | 70 | repo_name = match_dict.get('repo_name') |
|
71 | 71 | |
|
72 | 72 | if match_dict.get('f_path'): |
|
73 | 73 | # fix for multiple initial slashes that causes errors |
|
74 | 74 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') |
|
75 | 75 | repo_model = repo.RepoModel() |
|
76 | 76 | by_name_match = repo_model.get_by_repo_name(repo_name) |
|
77 | 77 | # if we match quickly from database, short circuit the operation, |
|
78 | 78 | # and validate repo based on the type. |
|
79 | 79 | if by_name_match: |
|
80 | 80 | return True |
|
81 | 81 | |
|
82 | 82 | by_id_match = repo_model.get_repo_by_id(repo_name) |
|
83 | 83 | if by_id_match: |
|
84 | 84 | repo_name = by_id_match.repo_name |
|
85 | 85 | match_dict['repo_name'] = repo_name |
|
86 | 86 | return True |
|
87 | 87 | |
|
88 | 88 | return False |
|
89 | 89 | |
|
90 | 90 | def check_group(environ, match_dict): |
|
91 | 91 | """ |
|
92 | 92 | check for valid repository group path for proper 404 handling |
|
93 | 93 | |
|
94 | 94 | :param environ: |
|
95 | 95 | :param match_dict: |
|
96 | 96 | """ |
|
97 | 97 | repo_group_name = match_dict.get('group_name') |
|
98 | 98 | repo_group_model = repo_group.RepoGroupModel() |
|
99 | 99 | by_name_match = repo_group_model.get_by_group_name(repo_group_name) |
|
100 | 100 | if by_name_match: |
|
101 | 101 | return True |
|
102 | 102 | |
|
103 | 103 | return False |
|
104 | 104 | |
|
105 | 105 | def check_user_group(environ, match_dict): |
|
106 | 106 | """ |
|
107 | 107 | check for valid user group for proper 404 handling |
|
108 | 108 | |
|
109 | 109 | :param environ: |
|
110 | 110 | :param match_dict: |
|
111 | 111 | """ |
|
112 | 112 | return True |
|
113 | 113 | |
|
114 | 114 | def check_int(environ, match_dict): |
|
115 | 115 | return match_dict.get('id').isdigit() |
|
116 | 116 | |
|
117 | 117 | # The ErrorController route (handles 404/500 error pages); it should |
|
118 | 118 | # likely stay at the top, ensuring it can always be resolved |
|
119 | 119 | rmap.connect('/error/{action}', controller='error') |
|
120 | 120 | rmap.connect('/error/{action}/{id}', controller='error') |
|
121 | 121 | |
|
122 | 122 | #========================================================================== |
|
123 | 123 | # CUSTOM ROUTES HERE |
|
124 | 124 | #========================================================================== |
|
125 | 125 | |
|
126 | 126 | # MAIN PAGE |
|
127 | 127 | rmap.connect('home', '/', controller='home', action='index') |
|
128 | 128 | rmap.connect('goto_switcher_data', '/_goto_data', controller='home', |
|
129 | 129 | action='goto_switcher_data') |
|
130 | 130 | rmap.connect('repo_list_data', '/_repos', controller='home', |
|
131 | 131 | action='repo_list_data') |
|
132 | 132 | |
|
133 | 133 | rmap.connect('user_autocomplete_data', '/_users', controller='home', |
|
134 | 134 | action='user_autocomplete_data') |
|
135 | 135 | rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home', |
|
136 | 136 | action='user_group_autocomplete_data') |
|
137 | 137 | |
|
138 | 138 | rmap.connect( |
|
139 | 139 | 'user_profile', '/_profiles/{username}', controller='users', |
|
140 | 140 | action='user_profile') |
|
141 | 141 | |
|
142 | 142 | # TODO: johbo: Static links, to be replaced by our redirection mechanism |
|
143 | 143 | rmap.connect('rst_help', |
|
144 | 144 | 'http://docutils.sourceforge.net/docs/user/rst/quickref.html', |
|
145 | 145 | _static=True) |
|
146 | 146 | rmap.connect('markdown_help', |
|
147 | 147 | 'http://daringfireball.net/projects/markdown/syntax', |
|
148 | 148 | _static=True) |
|
149 | 149 | rmap.connect('rhodecode_official', 'https://rhodecode.com', _static=True) |
|
150 | 150 | rmap.connect('rhodecode_support', 'https://rhodecode.com/help/', _static=True) |
|
151 | 151 | rmap.connect('rhodecode_translations', 'https://rhodecode.com/translate/enterprise', _static=True) |
|
152 | 152 | # TODO: anderson - making this a static link since redirect won't play |
|
153 | 153 | # nice with POST requests |
|
154 | 154 | rmap.connect('enterprise_license_convert_from_old', |
|
155 | 155 | 'https://rhodecode.com/u/license-upgrade', |
|
156 | 156 | _static=True) |
|
157 | 157 | |
|
158 | 158 | routing_links.connect_redirection_links(rmap) |
|
159 | 159 | |
|
160 | 160 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') |
|
161 | 161 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') |
|
162 | 162 | |
|
163 | 163 | # ADMIN REPOSITORY ROUTES |
|
164 | 164 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
165 | 165 | controller='admin/repos') as m: |
|
166 | 166 | m.connect('repos', '/repos', |
|
167 | 167 | action='create', conditions={'method': ['POST']}) |
|
168 | 168 | m.connect('repos', '/repos', |
|
169 | 169 | action='index', conditions={'method': ['GET']}) |
|
170 | 170 | m.connect('new_repo', '/create_repository', |
|
171 | 171 | action='create_repository', conditions={'method': ['GET']}) |
|
172 | 172 | m.connect('/repos/{repo_name}', |
|
173 | 173 | action='update', conditions={'method': ['PUT'], |
|
174 | 174 | 'function': check_repo}, |
|
175 | 175 | requirements=URL_NAME_REQUIREMENTS) |
|
176 | 176 | m.connect('delete_repo', '/repos/{repo_name}', |
|
177 | 177 | action='delete', conditions={'method': ['DELETE']}, |
|
178 | 178 | requirements=URL_NAME_REQUIREMENTS) |
|
179 | 179 | m.connect('repo', '/repos/{repo_name}', |
|
180 | 180 | action='show', conditions={'method': ['GET'], |
|
181 | 181 | 'function': check_repo}, |
|
182 | 182 | requirements=URL_NAME_REQUIREMENTS) |
|
183 | 183 | |
|
184 | 184 | # ADMIN REPOSITORY GROUPS ROUTES |
|
185 | 185 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
186 | 186 | controller='admin/repo_groups') as m: |
|
187 | 187 | m.connect('repo_groups', '/repo_groups', |
|
188 | 188 | action='create', conditions={'method': ['POST']}) |
|
189 | 189 | m.connect('repo_groups', '/repo_groups', |
|
190 | 190 | action='index', conditions={'method': ['GET']}) |
|
191 | 191 | m.connect('new_repo_group', '/repo_groups/new', |
|
192 | 192 | action='new', conditions={'method': ['GET']}) |
|
193 | 193 | m.connect('update_repo_group', '/repo_groups/{group_name}', |
|
194 | 194 | action='update', conditions={'method': ['PUT'], |
|
195 | 195 | 'function': check_group}, |
|
196 | 196 | requirements=URL_NAME_REQUIREMENTS) |
|
197 | 197 | |
|
198 | 198 | # EXTRAS REPO GROUP ROUTES |
|
199 | 199 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
200 | 200 | action='edit', |
|
201 | 201 | conditions={'method': ['GET'], 'function': check_group}, |
|
202 | 202 | requirements=URL_NAME_REQUIREMENTS) |
|
203 | 203 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
204 | 204 | action='edit', |
|
205 | 205 | conditions={'method': ['PUT'], 'function': check_group}, |
|
206 | 206 | requirements=URL_NAME_REQUIREMENTS) |
|
207 | 207 | |
|
208 | 208 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
209 | 209 | action='edit_repo_group_advanced', |
|
210 | 210 | conditions={'method': ['GET'], 'function': check_group}, |
|
211 | 211 | requirements=URL_NAME_REQUIREMENTS) |
|
212 | 212 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
213 | 213 | action='edit_repo_group_advanced', |
|
214 | 214 | conditions={'method': ['PUT'], 'function': check_group}, |
|
215 | 215 | requirements=URL_NAME_REQUIREMENTS) |
|
216 | 216 | |
|
217 | 217 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
218 | 218 | action='edit_repo_group_perms', |
|
219 | 219 | conditions={'method': ['GET'], 'function': check_group}, |
|
220 | 220 | requirements=URL_NAME_REQUIREMENTS) |
|
221 | 221 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
222 | 222 | action='update_perms', |
|
223 | 223 | conditions={'method': ['PUT'], 'function': check_group}, |
|
224 | 224 | requirements=URL_NAME_REQUIREMENTS) |
|
225 | 225 | |
|
226 | 226 | m.connect('delete_repo_group', '/repo_groups/{group_name}', |
|
227 | 227 | action='delete', conditions={'method': ['DELETE'], |
|
228 | 228 | 'function': check_group}, |
|
229 | 229 | requirements=URL_NAME_REQUIREMENTS) |
|
230 | 230 | |
|
231 | 231 | # ADMIN USER ROUTES |
|
232 | 232 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
233 | 233 | controller='admin/users') as m: |
|
234 | 234 | m.connect('users', '/users', |
|
235 | 235 | action='create', conditions={'method': ['POST']}) |
|
236 | 236 | m.connect('users', '/users', |
|
237 | 237 | action='index', conditions={'method': ['GET']}) |
|
238 | 238 | m.connect('new_user', '/users/new', |
|
239 | 239 | action='new', conditions={'method': ['GET']}) |
|
240 | 240 | m.connect('update_user', '/users/{user_id}', |
|
241 | 241 | action='update', conditions={'method': ['PUT']}) |
|
242 | 242 | m.connect('delete_user', '/users/{user_id}', |
|
243 | 243 | action='delete', conditions={'method': ['DELETE']}) |
|
244 | 244 | m.connect('edit_user', '/users/{user_id}/edit', |
|
245 | 245 | action='edit', conditions={'method': ['GET']}) |
|
246 | 246 | m.connect('user', '/users/{user_id}', |
|
247 | 247 | action='show', conditions={'method': ['GET']}) |
|
248 | 248 | m.connect('force_password_reset_user', '/users/{user_id}/password_reset', |
|
249 | 249 | action='reset_password', conditions={'method': ['POST']}) |
|
250 | 250 | m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group', |
|
251 | 251 | action='create_personal_repo_group', conditions={'method': ['POST']}) |
|
252 | 252 | |
|
253 | 253 | # EXTRAS USER ROUTES |
|
254 | 254 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
255 | 255 | action='edit_advanced', conditions={'method': ['GET']}) |
|
256 | 256 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
257 | 257 | action='update_advanced', conditions={'method': ['PUT']}) |
|
258 | 258 | |
|
259 | 259 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
260 | 260 | action='edit_auth_tokens', conditions={'method': ['GET']}) |
|
261 | 261 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
262 | 262 | action='add_auth_token', conditions={'method': ['PUT']}) |
|
263 | 263 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
264 | 264 | action='delete_auth_token', conditions={'method': ['DELETE']}) |
|
265 | 265 | |
|
266 | 266 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
267 | 267 | action='edit_global_perms', conditions={'method': ['GET']}) |
|
268 | 268 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
269 | 269 | action='update_global_perms', conditions={'method': ['PUT']}) |
|
270 | 270 | |
|
271 | 271 | m.connect('edit_user_perms_summary', '/users/{user_id}/edit/permissions_summary', |
|
272 | 272 | action='edit_perms_summary', conditions={'method': ['GET']}) |
|
273 | 273 | |
|
274 | 274 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
275 | 275 | action='edit_emails', conditions={'method': ['GET']}) |
|
276 | 276 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
277 | 277 | action='add_email', conditions={'method': ['PUT']}) |
|
278 | 278 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
279 | 279 | action='delete_email', conditions={'method': ['DELETE']}) |
|
280 | 280 | |
|
281 | 281 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
282 | 282 | action='edit_ips', conditions={'method': ['GET']}) |
|
283 | 283 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
284 | 284 | action='add_ip', conditions={'method': ['PUT']}) |
|
285 | 285 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
286 | 286 | action='delete_ip', conditions={'method': ['DELETE']}) |
|
287 | 287 | |
|
288 | 288 | # ADMIN USER GROUPS REST ROUTES |
|
289 | 289 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
290 | 290 | controller='admin/user_groups') as m: |
|
291 | 291 | m.connect('users_groups', '/user_groups', |
|
292 | 292 | action='create', conditions={'method': ['POST']}) |
|
293 | 293 | m.connect('users_groups', '/user_groups', |
|
294 | 294 | action='index', conditions={'method': ['GET']}) |
|
295 | 295 | m.connect('new_users_group', '/user_groups/new', |
|
296 | 296 | action='new', conditions={'method': ['GET']}) |
|
297 | 297 | m.connect('update_users_group', '/user_groups/{user_group_id}', |
|
298 | 298 | action='update', conditions={'method': ['PUT']}) |
|
299 | 299 | m.connect('delete_users_group', '/user_groups/{user_group_id}', |
|
300 | 300 | action='delete', conditions={'method': ['DELETE']}) |
|
301 | 301 | m.connect('edit_users_group', '/user_groups/{user_group_id}/edit', |
|
302 | 302 | action='edit', conditions={'method': ['GET']}, |
|
303 | 303 | function=check_user_group) |
|
304 | 304 | |
|
305 | 305 | # EXTRAS USER GROUP ROUTES |
|
306 | 306 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', |
|
307 | 307 | action='edit_global_perms', conditions={'method': ['GET']}) |
|
308 | 308 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', |
|
309 | 309 | action='update_global_perms', conditions={'method': ['PUT']}) |
|
310 | 310 | m.connect('edit_user_group_perms_summary', '/user_groups/{user_group_id}/edit/permissions_summary', |
|
311 | 311 | action='edit_perms_summary', conditions={'method': ['GET']}) |
|
312 | 312 | |
|
313 | 313 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', |
|
314 | 314 | action='edit_perms', conditions={'method': ['GET']}) |
|
315 | 315 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', |
|
316 | 316 | action='update_perms', conditions={'method': ['PUT']}) |
|
317 | 317 | |
|
318 | 318 | m.connect('edit_user_group_advanced', '/user_groups/{user_group_id}/edit/advanced', |
|
319 | 319 | action='edit_advanced', conditions={'method': ['GET']}) |
|
320 | 320 | |
|
321 | 321 | m.connect('edit_user_group_members', '/user_groups/{user_group_id}/edit/members', |
|
322 | 322 | action='edit_members', conditions={'method': ['GET']}) |
|
323 | 323 | |
|
324 | 324 | # ADMIN PERMISSIONS ROUTES |
|
325 | 325 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
326 | 326 | controller='admin/permissions') as m: |
|
327 | 327 | m.connect('admin_permissions_application', '/permissions/application', |
|
328 | 328 | action='permission_application_update', conditions={'method': ['POST']}) |
|
329 | 329 | m.connect('admin_permissions_application', '/permissions/application', |
|
330 | 330 | action='permission_application', conditions={'method': ['GET']}) |
|
331 | 331 | |
|
332 | 332 | m.connect('admin_permissions_global', '/permissions/global', |
|
333 | 333 | action='permission_global_update', conditions={'method': ['POST']}) |
|
334 | 334 | m.connect('admin_permissions_global', '/permissions/global', |
|
335 | 335 | action='permission_global', conditions={'method': ['GET']}) |
|
336 | 336 | |
|
337 | 337 | m.connect('admin_permissions_object', '/permissions/object', |
|
338 | 338 | action='permission_objects_update', conditions={'method': ['POST']}) |
|
339 | 339 | m.connect('admin_permissions_object', '/permissions/object', |
|
340 | 340 | action='permission_objects', conditions={'method': ['GET']}) |
|
341 | 341 | |
|
342 | 342 | m.connect('admin_permissions_ips', '/permissions/ips', |
|
343 | 343 | action='permission_ips', conditions={'method': ['POST']}) |
|
344 | 344 | m.connect('admin_permissions_ips', '/permissions/ips', |
|
345 | 345 | action='permission_ips', conditions={'method': ['GET']}) |
|
346 | 346 | |
|
347 | 347 | m.connect('admin_permissions_overview', '/permissions/overview', |
|
348 | 348 | action='permission_perms', conditions={'method': ['GET']}) |
|
349 | 349 | |
|
350 | 350 | # ADMIN DEFAULTS REST ROUTES |
|
351 | 351 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
352 | 352 | controller='admin/defaults') as m: |
|
353 | 353 | m.connect('admin_defaults_repositories', '/defaults/repositories', |
|
354 | 354 | action='update_repository_defaults', conditions={'method': ['POST']}) |
|
355 | 355 | m.connect('admin_defaults_repositories', '/defaults/repositories', |
|
356 | 356 | action='index', conditions={'method': ['GET']}) |
|
357 | 357 | |
|
358 | 358 | # ADMIN DEBUG STYLE ROUTES |
|
359 | 359 | if str2bool(config.get('debug_style')): |
|
360 | 360 | with rmap.submapper(path_prefix=ADMIN_PREFIX + '/debug_style', |
|
361 | 361 | controller='debug_style') as m: |
|
362 | 362 | m.connect('debug_style_home', '', |
|
363 | 363 | action='index', conditions={'method': ['GET']}) |
|
364 | 364 | m.connect('debug_style_template', '/t/{t_path}', |
|
365 | 365 | action='template', conditions={'method': ['GET']}) |
|
366 | 366 | |
|
367 | 367 | # ADMIN SETTINGS ROUTES |
|
368 | 368 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
369 | 369 | controller='admin/settings') as m: |
|
370 | 370 | |
|
371 | 371 | # default |
|
372 | 372 | m.connect('admin_settings', '/settings', |
|
373 | 373 | action='settings_global_update', |
|
374 | 374 | conditions={'method': ['POST']}) |
|
375 | 375 | m.connect('admin_settings', '/settings', |
|
376 | 376 | action='settings_global', conditions={'method': ['GET']}) |
|
377 | 377 | |
|
378 | 378 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
379 | 379 | action='settings_vcs_update', |
|
380 | 380 | conditions={'method': ['POST']}) |
|
381 | 381 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
382 | 382 | action='settings_vcs', |
|
383 | 383 | conditions={'method': ['GET']}) |
|
384 | 384 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
385 | 385 | action='delete_svn_pattern', |
|
386 | 386 | conditions={'method': ['DELETE']}) |
|
387 | 387 | |
|
388 | 388 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
389 | 389 | action='settings_mapping_update', |
|
390 | 390 | conditions={'method': ['POST']}) |
|
391 | 391 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
392 | 392 | action='settings_mapping', conditions={'method': ['GET']}) |
|
393 | 393 | |
|
394 | 394 | m.connect('admin_settings_global', '/settings/global', |
|
395 | 395 | action='settings_global_update', |
|
396 | 396 | conditions={'method': ['POST']}) |
|
397 | 397 | m.connect('admin_settings_global', '/settings/global', |
|
398 | 398 | action='settings_global', conditions={'method': ['GET']}) |
|
399 | 399 | |
|
400 | 400 | m.connect('admin_settings_visual', '/settings/visual', |
|
401 | 401 | action='settings_visual_update', |
|
402 | 402 | conditions={'method': ['POST']}) |
|
403 | 403 | m.connect('admin_settings_visual', '/settings/visual', |
|
404 | 404 | action='settings_visual', conditions={'method': ['GET']}) |
|
405 | 405 | |
|
406 | 406 | m.connect('admin_settings_issuetracker', |
|
407 | 407 | '/settings/issue-tracker', action='settings_issuetracker', |
|
408 | 408 | conditions={'method': ['GET']}) |
|
409 | 409 | m.connect('admin_settings_issuetracker_save', |
|
410 | 410 | '/settings/issue-tracker/save', |
|
411 | 411 | action='settings_issuetracker_save', |
|
412 | 412 | conditions={'method': ['POST']}) |
|
413 | 413 | m.connect('admin_issuetracker_test', '/settings/issue-tracker/test', |
|
414 | 414 | action='settings_issuetracker_test', |
|
415 | 415 | conditions={'method': ['POST']}) |
|
416 | 416 | m.connect('admin_issuetracker_delete', |
|
417 | 417 | '/settings/issue-tracker/delete', |
|
418 | 418 | action='settings_issuetracker_delete', |
|
419 | 419 | conditions={'method': ['DELETE']}) |
|
420 | 420 | |
|
421 | 421 | m.connect('admin_settings_email', '/settings/email', |
|
422 | 422 | action='settings_email_update', |
|
423 | 423 | conditions={'method': ['POST']}) |
|
424 | 424 | m.connect('admin_settings_email', '/settings/email', |
|
425 | 425 | action='settings_email', conditions={'method': ['GET']}) |
|
426 | 426 | |
|
427 | 427 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
428 | 428 | action='settings_hooks_update', |
|
429 | 429 | conditions={'method': ['POST', 'DELETE']}) |
|
430 | 430 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
431 | 431 | action='settings_hooks', conditions={'method': ['GET']}) |
|
432 | 432 | |
|
433 | 433 | m.connect('admin_settings_search', '/settings/search', |
|
434 | 434 | action='settings_search', conditions={'method': ['GET']}) |
|
435 | 435 | |
|
436 | 436 | m.connect('admin_settings_system', '/settings/system', |
|
437 | 437 | action='settings_system', conditions={'method': ['GET']}) |
|
438 | 438 | |
|
439 | 439 | m.connect('admin_settings_system_update', '/settings/system/updates', |
|
440 | 440 | action='settings_system_update', conditions={'method': ['GET']}) |
|
441 | 441 | |
|
442 | 442 | m.connect('admin_settings_supervisor', '/settings/supervisor', |
|
443 | 443 | action='settings_supervisor', conditions={'method': ['GET']}) |
|
444 | 444 | m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log', |
|
445 | 445 | action='settings_supervisor_log', conditions={'method': ['GET']}) |
|
446 | 446 | |
|
447 | 447 | m.connect('admin_settings_labs', '/settings/labs', |
|
448 | 448 | action='settings_labs_update', |
|
449 | 449 | conditions={'method': ['POST']}) |
|
450 | 450 | m.connect('admin_settings_labs', '/settings/labs', |
|
451 | 451 | action='settings_labs', conditions={'method': ['GET']}) |
|
452 | 452 | |
|
453 | 453 | m.connect('admin_settings_open_source', '/settings/open_source', |
|
454 | 454 | action='settings_open_source', |
|
455 | 455 | conditions={'method': ['GET']}) |
|
456 | 456 | |
|
457 | 457 | # ADMIN MY ACCOUNT |
|
458 | 458 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
459 | 459 | controller='admin/my_account') as m: |
|
460 | 460 | |
|
461 | 461 | m.connect('my_account', '/my_account', |
|
462 | 462 | action='my_account', conditions={'method': ['GET']}) |
|
463 | 463 | m.connect('my_account_edit', '/my_account/edit', |
|
464 | 464 | action='my_account_edit', conditions={'method': ['GET']}) |
|
465 | 465 | m.connect('my_account', '/my_account', |
|
466 | 466 | action='my_account_update', conditions={'method': ['POST']}) |
|
467 | 467 | |
|
468 | 468 | m.connect('my_account_password', '/my_account/password', |
|
469 | 469 | action='my_account_password', conditions={'method': ['GET']}) |
|
470 | 470 | m.connect('my_account_password', '/my_account/password', |
|
471 | 471 | action='my_account_password_update', conditions={'method': ['POST']}) |
|
472 | 472 | |
|
473 | 473 | m.connect('my_account_repos', '/my_account/repos', |
|
474 | 474 | action='my_account_repos', conditions={'method': ['GET']}) |
|
475 | 475 | |
|
476 | 476 | m.connect('my_account_watched', '/my_account/watched', |
|
477 | 477 | action='my_account_watched', conditions={'method': ['GET']}) |
|
478 | 478 | |
|
479 | 479 | m.connect('my_account_pullrequests', '/my_account/pull_requests', |
|
480 | 480 | action='my_account_pullrequests', conditions={'method': ['GET']}) |
|
481 | 481 | |
|
482 | 482 | m.connect('my_account_perms', '/my_account/perms', |
|
483 | 483 | action='my_account_perms', conditions={'method': ['GET']}) |
|
484 | 484 | |
|
485 | 485 | m.connect('my_account_emails', '/my_account/emails', |
|
486 | 486 | action='my_account_emails', conditions={'method': ['GET']}) |
|
487 | 487 | m.connect('my_account_emails', '/my_account/emails', |
|
488 | 488 | action='my_account_emails_add', conditions={'method': ['POST']}) |
|
489 | 489 | m.connect('my_account_emails', '/my_account/emails', |
|
490 | 490 | action='my_account_emails_delete', conditions={'method': ['DELETE']}) |
|
491 | 491 | |
|
492 | 492 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
493 | 493 | action='my_account_auth_tokens', conditions={'method': ['GET']}) |
|
494 | 494 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
495 | 495 | action='my_account_auth_tokens_add', conditions={'method': ['POST']}) |
|
496 | 496 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
497 | 497 | action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']}) |
|
498 | 498 | |
|
499 | 499 | # NOTIFICATION REST ROUTES |
|
500 | 500 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
501 | 501 | controller='admin/notifications') as m: |
|
502 | 502 | m.connect('notifications', '/notifications', |
|
503 | 503 | action='index', conditions={'method': ['GET']}) |
|
504 | 504 | m.connect('notifications_mark_all_read', '/notifications/mark_all_read', |
|
505 | 505 | action='mark_all_read', conditions={'method': ['POST']}) |
|
506 | 506 | |
|
507 | 507 | m.connect('/notifications/{notification_id}', |
|
508 | 508 | action='update', conditions={'method': ['PUT']}) |
|
509 | 509 | m.connect('/notifications/{notification_id}', |
|
510 | 510 | action='delete', conditions={'method': ['DELETE']}) |
|
511 | 511 | m.connect('notification', '/notifications/{notification_id}', |
|
512 | 512 | action='show', conditions={'method': ['GET']}) |
|
513 | 513 | |
|
514 | 514 | # ADMIN GIST |
|
515 | 515 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
516 | 516 | controller='admin/gists') as m: |
|
517 | 517 | m.connect('gists', '/gists', |
|
518 | 518 | action='create', conditions={'method': ['POST']}) |
|
519 | 519 | m.connect('gists', '/gists', |
|
520 | 520 | action='index', conditions={'method': ['GET']}) |
|
521 | 521 | m.connect('new_gist', '/gists/new', |
|
522 | 522 | action='new', conditions={'method': ['GET']}) |
|
523 | 523 | |
|
524 | 524 | m.connect('/gists/{gist_id}', |
|
525 | 525 | action='delete', conditions={'method': ['DELETE']}) |
|
526 | 526 | m.connect('edit_gist', '/gists/{gist_id}/edit', |
|
527 | 527 | action='edit_form', conditions={'method': ['GET']}) |
|
528 | 528 | m.connect('edit_gist', '/gists/{gist_id}/edit', |
|
529 | 529 | action='edit', conditions={'method': ['POST']}) |
|
530 | 530 | m.connect( |
|
531 | 531 | 'edit_gist_check_revision', '/gists/{gist_id}/edit/check_revision', |
|
532 | 532 | action='check_revision', conditions={'method': ['GET']}) |
|
533 | 533 | |
|
534 | 534 | m.connect('gist', '/gists/{gist_id}', |
|
535 | 535 | action='show', conditions={'method': ['GET']}) |
|
536 | 536 | m.connect('gist_rev', '/gists/{gist_id}/{revision}', |
|
537 | 537 | revision='tip', |
|
538 | 538 | action='show', conditions={'method': ['GET']}) |
|
539 | 539 | m.connect('formatted_gist', '/gists/{gist_id}/{revision}/{format}', |
|
540 | 540 | revision='tip', |
|
541 | 541 | action='show', conditions={'method': ['GET']}) |
|
542 | 542 | m.connect('formatted_gist_file', '/gists/{gist_id}/{revision}/{format}/{f_path}', |
|
543 | 543 | revision='tip', |
|
544 | 544 | action='show', conditions={'method': ['GET']}, |
|
545 | 545 | requirements=URL_NAME_REQUIREMENTS) |
|
546 | 546 | |
|
547 | 547 | # ADMIN MAIN PAGES |
|
548 | 548 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
549 | 549 | controller='admin/admin') as m: |
|
550 | 550 | m.connect('admin_home', '', action='index') |
|
551 | 551 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
552 | 552 | action='add_repo') |
|
553 | 553 | m.connect( |
|
554 | 'pull_requests_global', '/pull_requests/{pull_request_id:[0-9]+}', | |
|
554 | 'pull_requests_global_0', '/pull_requests/{pull_request_id:[0-9]+}', | |
|
555 | 555 | action='pull_requests') |
|
556 | m.connect( | |
|
557 | 'pull_requests_global', '/pull-requests/{pull_request_id:[0-9]+}', | |
|
558 | action='pull_requests') | |
|
559 | ||
|
556 | 560 | |
|
557 | 561 | # USER JOURNAL |
|
558 | 562 | rmap.connect('journal', '%s/journal' % (ADMIN_PREFIX,), |
|
559 | 563 | controller='journal', action='index') |
|
560 | 564 | rmap.connect('journal_rss', '%s/journal/rss' % (ADMIN_PREFIX,), |
|
561 | 565 | controller='journal', action='journal_rss') |
|
562 | 566 | rmap.connect('journal_atom', '%s/journal/atom' % (ADMIN_PREFIX,), |
|
563 | 567 | controller='journal', action='journal_atom') |
|
564 | 568 | |
|
565 | 569 | rmap.connect('public_journal', '%s/public_journal' % (ADMIN_PREFIX,), |
|
566 | 570 | controller='journal', action='public_journal') |
|
567 | 571 | |
|
568 | 572 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % (ADMIN_PREFIX,), |
|
569 | 573 | controller='journal', action='public_journal_rss') |
|
570 | 574 | |
|
571 | 575 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % (ADMIN_PREFIX,), |
|
572 | 576 | controller='journal', action='public_journal_rss') |
|
573 | 577 | |
|
574 | 578 | rmap.connect('public_journal_atom', |
|
575 | 579 | '%s/public_journal/atom' % (ADMIN_PREFIX,), controller='journal', |
|
576 | 580 | action='public_journal_atom') |
|
577 | 581 | |
|
578 | 582 | rmap.connect('public_journal_atom_old', |
|
579 | 583 | '%s/public_journal_atom' % (ADMIN_PREFIX,), controller='journal', |
|
580 | 584 | action='public_journal_atom') |
|
581 | 585 | |
|
582 | 586 | rmap.connect('toggle_following', '%s/toggle_following' % (ADMIN_PREFIX,), |
|
583 | 587 | controller='journal', action='toggle_following', |
|
584 | 588 | conditions={'method': ['POST']}) |
|
585 | 589 | |
|
586 | 590 | # FULL TEXT SEARCH |
|
587 | 591 | rmap.connect('search', '%s/search' % (ADMIN_PREFIX,), |
|
588 | 592 | controller='search') |
|
589 | 593 | rmap.connect('search_repo_home', '/{repo_name}/search', |
|
590 | 594 | controller='search', |
|
591 | 595 | action='index', |
|
592 | 596 | conditions={'function': check_repo}, |
|
593 | 597 | requirements=URL_NAME_REQUIREMENTS) |
|
594 | 598 | |
|
595 | 599 | # FEEDS |
|
596 | 600 | rmap.connect('rss_feed_home', '/{repo_name}/feed/rss', |
|
597 | 601 | controller='feed', action='rss', |
|
598 | 602 | conditions={'function': check_repo}, |
|
599 | 603 | requirements=URL_NAME_REQUIREMENTS) |
|
600 | 604 | |
|
601 | 605 | rmap.connect('atom_feed_home', '/{repo_name}/feed/atom', |
|
602 | 606 | controller='feed', action='atom', |
|
603 | 607 | conditions={'function': check_repo}, |
|
604 | 608 | requirements=URL_NAME_REQUIREMENTS) |
|
605 | 609 | |
|
606 | 610 | #========================================================================== |
|
607 | 611 | # REPOSITORY ROUTES |
|
608 | 612 | #========================================================================== |
|
609 | 613 | |
|
610 | 614 | rmap.connect('repo_creating_home', '/{repo_name}/repo_creating', |
|
611 | 615 | controller='admin/repos', action='repo_creating', |
|
612 | 616 | requirements=URL_NAME_REQUIREMENTS) |
|
613 | 617 | rmap.connect('repo_check_home', '/{repo_name}/crepo_check', |
|
614 | 618 | controller='admin/repos', action='repo_check', |
|
615 | 619 | requirements=URL_NAME_REQUIREMENTS) |
|
616 | 620 | |
|
617 | 621 | rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}', |
|
618 | 622 | controller='summary', action='repo_stats', |
|
619 | 623 | conditions={'function': check_repo}, |
|
620 | 624 | requirements=URL_NAME_REQUIREMENTS) |
|
621 | 625 | |
|
622 | 626 | rmap.connect('repo_refs_data', '/{repo_name}/refs-data', |
|
623 | 627 | controller='summary', action='repo_refs_data', |
|
624 | 628 | requirements=URL_NAME_REQUIREMENTS) |
|
625 | 629 | rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog', |
|
626 | 630 | controller='summary', action='repo_refs_changelog_data', |
|
627 | 631 | requirements=URL_NAME_REQUIREMENTS) |
|
628 | 632 | |
|
629 | 633 | rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}', |
|
630 | 634 | controller='changeset', revision='tip', |
|
631 | 635 | conditions={'function': check_repo}, |
|
632 | 636 | requirements=URL_NAME_REQUIREMENTS) |
|
633 | 637 | rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}', |
|
634 | 638 | controller='changeset', revision='tip', action='changeset_children', |
|
635 | 639 | conditions={'function': check_repo}, |
|
636 | 640 | requirements=URL_NAME_REQUIREMENTS) |
|
637 | 641 | rmap.connect('changeset_parents', '/{repo_name}/changeset_parents/{revision}', |
|
638 | 642 | controller='changeset', revision='tip', action='changeset_parents', |
|
639 | 643 | conditions={'function': check_repo}, |
|
640 | 644 | requirements=URL_NAME_REQUIREMENTS) |
|
641 | 645 | |
|
642 | 646 | # repo edit options |
|
643 | 647 | rmap.connect('edit_repo', '/{repo_name}/settings', |
|
644 | 648 | controller='admin/repos', action='edit', |
|
645 | 649 | conditions={'method': ['GET'], 'function': check_repo}, |
|
646 | 650 | requirements=URL_NAME_REQUIREMENTS) |
|
647 | 651 | |
|
648 | 652 | rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions', |
|
649 | 653 | controller='admin/repos', action='edit_permissions', |
|
650 | 654 | conditions={'method': ['GET'], 'function': check_repo}, |
|
651 | 655 | requirements=URL_NAME_REQUIREMENTS) |
|
652 | 656 | rmap.connect('edit_repo_perms_update', '/{repo_name}/settings/permissions', |
|
653 | 657 | controller='admin/repos', action='edit_permissions_update', |
|
654 | 658 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
655 | 659 | requirements=URL_NAME_REQUIREMENTS) |
|
656 | 660 | |
|
657 | 661 | rmap.connect('edit_repo_fields', '/{repo_name}/settings/fields', |
|
658 | 662 | controller='admin/repos', action='edit_fields', |
|
659 | 663 | conditions={'method': ['GET'], 'function': check_repo}, |
|
660 | 664 | requirements=URL_NAME_REQUIREMENTS) |
|
661 | 665 | rmap.connect('create_repo_fields', '/{repo_name}/settings/fields/new', |
|
662 | 666 | controller='admin/repos', action='create_repo_field', |
|
663 | 667 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
664 | 668 | requirements=URL_NAME_REQUIREMENTS) |
|
665 | 669 | rmap.connect('delete_repo_fields', '/{repo_name}/settings/fields/{field_id}', |
|
666 | 670 | controller='admin/repos', action='delete_repo_field', |
|
667 | 671 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
668 | 672 | requirements=URL_NAME_REQUIREMENTS) |
|
669 | 673 | |
|
670 | 674 | rmap.connect('edit_repo_advanced', '/{repo_name}/settings/advanced', |
|
671 | 675 | controller='admin/repos', action='edit_advanced', |
|
672 | 676 | conditions={'method': ['GET'], 'function': check_repo}, |
|
673 | 677 | requirements=URL_NAME_REQUIREMENTS) |
|
674 | 678 | |
|
675 | 679 | rmap.connect('edit_repo_advanced_locking', '/{repo_name}/settings/advanced/locking', |
|
676 | 680 | controller='admin/repos', action='edit_advanced_locking', |
|
677 | 681 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
678 | 682 | requirements=URL_NAME_REQUIREMENTS) |
|
679 | 683 | rmap.connect('toggle_locking', '/{repo_name}/settings/advanced/locking_toggle', |
|
680 | 684 | controller='admin/repos', action='toggle_locking', |
|
681 | 685 | conditions={'method': ['GET'], 'function': check_repo}, |
|
682 | 686 | requirements=URL_NAME_REQUIREMENTS) |
|
683 | 687 | |
|
684 | 688 | rmap.connect('edit_repo_advanced_journal', '/{repo_name}/settings/advanced/journal', |
|
685 | 689 | controller='admin/repos', action='edit_advanced_journal', |
|
686 | 690 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
687 | 691 | requirements=URL_NAME_REQUIREMENTS) |
|
688 | 692 | |
|
689 | 693 | rmap.connect('edit_repo_advanced_fork', '/{repo_name}/settings/advanced/fork', |
|
690 | 694 | controller='admin/repos', action='edit_advanced_fork', |
|
691 | 695 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
692 | 696 | requirements=URL_NAME_REQUIREMENTS) |
|
693 | 697 | |
|
694 | 698 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', |
|
695 | 699 | controller='admin/repos', action='edit_caches_form', |
|
696 | 700 | conditions={'method': ['GET'], 'function': check_repo}, |
|
697 | 701 | requirements=URL_NAME_REQUIREMENTS) |
|
698 | 702 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', |
|
699 | 703 | controller='admin/repos', action='edit_caches', |
|
700 | 704 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
701 | 705 | requirements=URL_NAME_REQUIREMENTS) |
|
702 | 706 | |
|
703 | 707 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', |
|
704 | 708 | controller='admin/repos', action='edit_remote_form', |
|
705 | 709 | conditions={'method': ['GET'], 'function': check_repo}, |
|
706 | 710 | requirements=URL_NAME_REQUIREMENTS) |
|
707 | 711 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', |
|
708 | 712 | controller='admin/repos', action='edit_remote', |
|
709 | 713 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
710 | 714 | requirements=URL_NAME_REQUIREMENTS) |
|
711 | 715 | |
|
712 | 716 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', |
|
713 | 717 | controller='admin/repos', action='edit_statistics_form', |
|
714 | 718 | conditions={'method': ['GET'], 'function': check_repo}, |
|
715 | 719 | requirements=URL_NAME_REQUIREMENTS) |
|
716 | 720 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', |
|
717 | 721 | controller='admin/repos', action='edit_statistics', |
|
718 | 722 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
719 | 723 | requirements=URL_NAME_REQUIREMENTS) |
|
720 | 724 | rmap.connect('repo_settings_issuetracker', |
|
721 | 725 | '/{repo_name}/settings/issue-tracker', |
|
722 | 726 | controller='admin/repos', action='repo_issuetracker', |
|
723 | 727 | conditions={'method': ['GET'], 'function': check_repo}, |
|
724 | 728 | requirements=URL_NAME_REQUIREMENTS) |
|
725 | 729 | rmap.connect('repo_issuetracker_test', |
|
726 | 730 | '/{repo_name}/settings/issue-tracker/test', |
|
727 | 731 | controller='admin/repos', action='repo_issuetracker_test', |
|
728 | 732 | conditions={'method': ['POST'], 'function': check_repo}, |
|
729 | 733 | requirements=URL_NAME_REQUIREMENTS) |
|
730 | 734 | rmap.connect('repo_issuetracker_delete', |
|
731 | 735 | '/{repo_name}/settings/issue-tracker/delete', |
|
732 | 736 | controller='admin/repos', action='repo_issuetracker_delete', |
|
733 | 737 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
734 | 738 | requirements=URL_NAME_REQUIREMENTS) |
|
735 | 739 | rmap.connect('repo_issuetracker_save', |
|
736 | 740 | '/{repo_name}/settings/issue-tracker/save', |
|
737 | 741 | controller='admin/repos', action='repo_issuetracker_save', |
|
738 | 742 | conditions={'method': ['POST'], 'function': check_repo}, |
|
739 | 743 | requirements=URL_NAME_REQUIREMENTS) |
|
740 | 744 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
741 | 745 | controller='admin/repos', action='repo_settings_vcs_update', |
|
742 | 746 | conditions={'method': ['POST'], 'function': check_repo}, |
|
743 | 747 | requirements=URL_NAME_REQUIREMENTS) |
|
744 | 748 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
745 | 749 | controller='admin/repos', action='repo_settings_vcs', |
|
746 | 750 | conditions={'method': ['GET'], 'function': check_repo}, |
|
747 | 751 | requirements=URL_NAME_REQUIREMENTS) |
|
748 | 752 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
749 | 753 | controller='admin/repos', action='repo_delete_svn_pattern', |
|
750 | 754 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
751 | 755 | requirements=URL_NAME_REQUIREMENTS) |
|
752 | 756 | |
|
753 | 757 | # still working url for backward compat. |
|
754 | 758 | rmap.connect('raw_changeset_home_depraced', |
|
755 | 759 | '/{repo_name}/raw-changeset/{revision}', |
|
756 | 760 | controller='changeset', action='changeset_raw', |
|
757 | 761 | revision='tip', conditions={'function': check_repo}, |
|
758 | 762 | requirements=URL_NAME_REQUIREMENTS) |
|
759 | 763 | |
|
760 | 764 | # new URLs |
|
761 | 765 | rmap.connect('changeset_raw_home', |
|
762 | 766 | '/{repo_name}/changeset-diff/{revision}', |
|
763 | 767 | controller='changeset', action='changeset_raw', |
|
764 | 768 | revision='tip', conditions={'function': check_repo}, |
|
765 | 769 | requirements=URL_NAME_REQUIREMENTS) |
|
766 | 770 | |
|
767 | 771 | rmap.connect('changeset_patch_home', |
|
768 | 772 | '/{repo_name}/changeset-patch/{revision}', |
|
769 | 773 | controller='changeset', action='changeset_patch', |
|
770 | 774 | revision='tip', conditions={'function': check_repo}, |
|
771 | 775 | requirements=URL_NAME_REQUIREMENTS) |
|
772 | 776 | |
|
773 | 777 | rmap.connect('changeset_download_home', |
|
774 | 778 | '/{repo_name}/changeset-download/{revision}', |
|
775 | 779 | controller='changeset', action='changeset_download', |
|
776 | 780 | revision='tip', conditions={'function': check_repo}, |
|
777 | 781 | requirements=URL_NAME_REQUIREMENTS) |
|
778 | 782 | |
|
779 | 783 | rmap.connect('changeset_comment', |
|
780 | 784 | '/{repo_name}/changeset/{revision}/comment', |
|
781 | 785 | controller='changeset', revision='tip', action='comment', |
|
782 | 786 | conditions={'function': check_repo}, |
|
783 | 787 | requirements=URL_NAME_REQUIREMENTS) |
|
784 | 788 | |
|
785 | 789 | rmap.connect('changeset_comment_preview', |
|
786 | 790 | '/{repo_name}/changeset/comment/preview', |
|
787 | 791 | controller='changeset', action='preview_comment', |
|
788 | 792 | conditions={'function': check_repo, 'method': ['POST']}, |
|
789 | 793 | requirements=URL_NAME_REQUIREMENTS) |
|
790 | 794 | |
|
791 | 795 | rmap.connect('changeset_comment_delete', |
|
792 | 796 | '/{repo_name}/changeset/comment/{comment_id}/delete', |
|
793 | 797 | controller='changeset', action='delete_comment', |
|
794 | 798 | conditions={'function': check_repo, 'method': ['DELETE']}, |
|
795 | 799 | requirements=URL_NAME_REQUIREMENTS) |
|
796 | 800 | |
|
797 | 801 | rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}', |
|
798 | 802 | controller='changeset', action='changeset_info', |
|
799 | 803 | requirements=URL_NAME_REQUIREMENTS) |
|
800 | 804 | |
|
801 | 805 | rmap.connect('compare_home', |
|
802 | 806 | '/{repo_name}/compare', |
|
803 | 807 | controller='compare', action='index', |
|
804 | 808 | conditions={'function': check_repo}, |
|
805 | 809 | requirements=URL_NAME_REQUIREMENTS) |
|
806 | 810 | |
|
807 | 811 | rmap.connect('compare_url', |
|
808 | 812 | '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}', |
|
809 | 813 | controller='compare', action='compare', |
|
810 | 814 | conditions={'function': check_repo}, |
|
811 | 815 | requirements=URL_NAME_REQUIREMENTS) |
|
812 | 816 | |
|
813 | 817 | rmap.connect('pullrequest_home', |
|
814 | 818 | '/{repo_name}/pull-request/new', controller='pullrequests', |
|
815 | 819 | action='index', conditions={'function': check_repo, |
|
816 | 820 | 'method': ['GET']}, |
|
817 | 821 | requirements=URL_NAME_REQUIREMENTS) |
|
818 | 822 | |
|
819 | 823 | rmap.connect('pullrequest', |
|
820 | 824 | '/{repo_name}/pull-request/new', controller='pullrequests', |
|
821 | 825 | action='create', conditions={'function': check_repo, |
|
822 | 826 | 'method': ['POST']}, |
|
823 | 827 | requirements=URL_NAME_REQUIREMENTS) |
|
824 | 828 | |
|
825 | 829 | rmap.connect('pullrequest_repo_refs', |
|
826 | 830 | '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}', |
|
827 | 831 | controller='pullrequests', |
|
828 | 832 | action='get_repo_refs', |
|
829 | 833 | conditions={'function': check_repo, 'method': ['GET']}, |
|
830 | 834 | requirements=URL_NAME_REQUIREMENTS) |
|
831 | 835 | |
|
832 | 836 | rmap.connect('pullrequest_repo_destinations', |
|
833 | 837 | '/{repo_name}/pull-request/repo-destinations', |
|
834 | 838 | controller='pullrequests', |
|
835 | 839 | action='get_repo_destinations', |
|
836 | 840 | conditions={'function': check_repo, 'method': ['GET']}, |
|
837 | 841 | requirements=URL_NAME_REQUIREMENTS) |
|
838 | 842 | |
|
839 | 843 | rmap.connect('pullrequest_show', |
|
840 | 844 | '/{repo_name}/pull-request/{pull_request_id}', |
|
841 | 845 | controller='pullrequests', |
|
842 | 846 | action='show', conditions={'function': check_repo, |
|
843 | 847 | 'method': ['GET']}, |
|
844 | 848 | requirements=URL_NAME_REQUIREMENTS) |
|
845 | 849 | |
|
846 | 850 | rmap.connect('pullrequest_update', |
|
847 | 851 | '/{repo_name}/pull-request/{pull_request_id}', |
|
848 | 852 | controller='pullrequests', |
|
849 | 853 | action='update', conditions={'function': check_repo, |
|
850 | 854 | 'method': ['PUT']}, |
|
851 | 855 | requirements=URL_NAME_REQUIREMENTS) |
|
852 | 856 | |
|
853 | 857 | rmap.connect('pullrequest_merge', |
|
854 | 858 | '/{repo_name}/pull-request/{pull_request_id}', |
|
855 | 859 | controller='pullrequests', |
|
856 | 860 | action='merge', conditions={'function': check_repo, |
|
857 | 861 | 'method': ['POST']}, |
|
858 | 862 | requirements=URL_NAME_REQUIREMENTS) |
|
859 | 863 | |
|
860 | 864 | rmap.connect('pullrequest_delete', |
|
861 | 865 | '/{repo_name}/pull-request/{pull_request_id}', |
|
862 | 866 | controller='pullrequests', |
|
863 | 867 | action='delete', conditions={'function': check_repo, |
|
864 | 868 | 'method': ['DELETE']}, |
|
865 | 869 | requirements=URL_NAME_REQUIREMENTS) |
|
866 | 870 | |
|
867 | 871 | rmap.connect('pullrequest_show_all', |
|
868 | 872 | '/{repo_name}/pull-request', |
|
869 | 873 | controller='pullrequests', |
|
870 | 874 | action='show_all', conditions={'function': check_repo, |
|
871 | 875 | 'method': ['GET']}, |
|
872 | 876 | requirements=URL_NAME_REQUIREMENTS) |
|
873 | 877 | |
|
874 | 878 | rmap.connect('pullrequest_comment', |
|
875 | 879 | '/{repo_name}/pull-request-comment/{pull_request_id}', |
|
876 | 880 | controller='pullrequests', |
|
877 | 881 | action='comment', conditions={'function': check_repo, |
|
878 | 882 | 'method': ['POST']}, |
|
879 | 883 | requirements=URL_NAME_REQUIREMENTS) |
|
880 | 884 | |
|
881 | 885 | rmap.connect('pullrequest_comment_delete', |
|
882 | 886 | '/{repo_name}/pull-request-comment/{comment_id}/delete', |
|
883 | 887 | controller='pullrequests', action='delete_comment', |
|
884 | 888 | conditions={'function': check_repo, 'method': ['DELETE']}, |
|
885 | 889 | requirements=URL_NAME_REQUIREMENTS) |
|
886 | 890 | |
|
887 | 891 | rmap.connect('summary_home_explicit', '/{repo_name}/summary', |
|
888 | 892 | controller='summary', conditions={'function': check_repo}, |
|
889 | 893 | requirements=URL_NAME_REQUIREMENTS) |
|
890 | 894 | |
|
891 | 895 | rmap.connect('branches_home', '/{repo_name}/branches', |
|
892 | 896 | controller='branches', conditions={'function': check_repo}, |
|
893 | 897 | requirements=URL_NAME_REQUIREMENTS) |
|
894 | 898 | |
|
895 | 899 | rmap.connect('tags_home', '/{repo_name}/tags', |
|
896 | 900 | controller='tags', conditions={'function': check_repo}, |
|
897 | 901 | requirements=URL_NAME_REQUIREMENTS) |
|
898 | 902 | |
|
899 | 903 | rmap.connect('bookmarks_home', '/{repo_name}/bookmarks', |
|
900 | 904 | controller='bookmarks', conditions={'function': check_repo}, |
|
901 | 905 | requirements=URL_NAME_REQUIREMENTS) |
|
902 | 906 | |
|
903 | 907 | rmap.connect('changelog_home', '/{repo_name}/changelog', |
|
904 | 908 | controller='changelog', conditions={'function': check_repo}, |
|
905 | 909 | requirements=URL_NAME_REQUIREMENTS) |
|
906 | 910 | |
|
907 | 911 | rmap.connect('changelog_summary_home', '/{repo_name}/changelog_summary', |
|
908 | 912 | controller='changelog', action='changelog_summary', |
|
909 | 913 | conditions={'function': check_repo}, |
|
910 | 914 | requirements=URL_NAME_REQUIREMENTS) |
|
911 | 915 | |
|
912 | 916 | rmap.connect('changelog_file_home', '/{repo_name}/changelog/{revision}/{f_path}', |
|
913 | 917 | controller='changelog', f_path=None, |
|
914 | 918 | conditions={'function': check_repo}, |
|
915 | 919 | requirements=URL_NAME_REQUIREMENTS) |
|
916 | 920 | |
|
917 | 921 | rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}', |
|
918 | 922 | controller='changelog', action='changelog_details', |
|
919 | 923 | conditions={'function': check_repo}, |
|
920 | 924 | requirements=URL_NAME_REQUIREMENTS) |
|
921 | 925 | |
|
922 | 926 | rmap.connect('files_home', |
|
923 | 927 | '/{repo_name}/files/{revision}/{f_path}', |
|
924 | 928 | controller='files', revision='tip', f_path='', |
|
925 | 929 | conditions={'function': check_repo}, |
|
926 | 930 | requirements=URL_NAME_REQUIREMENTS) |
|
927 | 931 | |
|
928 | 932 | rmap.connect('files_home_simple_catchrev', |
|
929 | 933 | '/{repo_name}/files/{revision}', |
|
930 | 934 | controller='files', revision='tip', f_path='', |
|
931 | 935 | conditions={'function': check_repo}, |
|
932 | 936 | requirements=URL_NAME_REQUIREMENTS) |
|
933 | 937 | |
|
934 | 938 | rmap.connect('files_home_simple_catchall', |
|
935 | 939 | '/{repo_name}/files', |
|
936 | 940 | controller='files', revision='tip', f_path='', |
|
937 | 941 | conditions={'function': check_repo}, |
|
938 | 942 | requirements=URL_NAME_REQUIREMENTS) |
|
939 | 943 | |
|
940 | 944 | rmap.connect('files_history_home', |
|
941 | 945 | '/{repo_name}/history/{revision}/{f_path}', |
|
942 | 946 | controller='files', action='history', revision='tip', f_path='', |
|
943 | 947 | conditions={'function': check_repo}, |
|
944 | 948 | requirements=URL_NAME_REQUIREMENTS) |
|
945 | 949 | |
|
946 | 950 | rmap.connect('files_authors_home', |
|
947 | 951 | '/{repo_name}/authors/{revision}/{f_path}', |
|
948 | 952 | controller='files', action='authors', revision='tip', f_path='', |
|
949 | 953 | conditions={'function': check_repo}, |
|
950 | 954 | requirements=URL_NAME_REQUIREMENTS) |
|
951 | 955 | |
|
952 | 956 | rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}', |
|
953 | 957 | controller='files', action='diff', f_path='', |
|
954 | 958 | conditions={'function': check_repo}, |
|
955 | 959 | requirements=URL_NAME_REQUIREMENTS) |
|
956 | 960 | |
|
957 | 961 | rmap.connect('files_diff_2way_home', |
|
958 | 962 | '/{repo_name}/diff-2way/{f_path}', |
|
959 | 963 | controller='files', action='diff_2way', f_path='', |
|
960 | 964 | conditions={'function': check_repo}, |
|
961 | 965 | requirements=URL_NAME_REQUIREMENTS) |
|
962 | 966 | |
|
963 | 967 | rmap.connect('files_rawfile_home', |
|
964 | 968 | '/{repo_name}/rawfile/{revision}/{f_path}', |
|
965 | 969 | controller='files', action='rawfile', revision='tip', |
|
966 | 970 | f_path='', conditions={'function': check_repo}, |
|
967 | 971 | requirements=URL_NAME_REQUIREMENTS) |
|
968 | 972 | |
|
969 | 973 | rmap.connect('files_raw_home', |
|
970 | 974 | '/{repo_name}/raw/{revision}/{f_path}', |
|
971 | 975 | controller='files', action='raw', revision='tip', f_path='', |
|
972 | 976 | conditions={'function': check_repo}, |
|
973 | 977 | requirements=URL_NAME_REQUIREMENTS) |
|
974 | 978 | |
|
975 | 979 | rmap.connect('files_render_home', |
|
976 | 980 | '/{repo_name}/render/{revision}/{f_path}', |
|
977 | 981 | controller='files', action='index', revision='tip', f_path='', |
|
978 | 982 | rendered=True, conditions={'function': check_repo}, |
|
979 | 983 | requirements=URL_NAME_REQUIREMENTS) |
|
980 | 984 | |
|
981 | 985 | rmap.connect('files_annotate_home', |
|
982 | 986 | '/{repo_name}/annotate/{revision}/{f_path}', |
|
983 | 987 | controller='files', action='index', revision='tip', |
|
984 | 988 | f_path='', annotate=True, conditions={'function': check_repo}, |
|
985 | 989 | requirements=URL_NAME_REQUIREMENTS) |
|
986 | 990 | |
|
987 | 991 | rmap.connect('files_edit', |
|
988 | 992 | '/{repo_name}/edit/{revision}/{f_path}', |
|
989 | 993 | controller='files', action='edit', revision='tip', |
|
990 | 994 | f_path='', |
|
991 | 995 | conditions={'function': check_repo, 'method': ['POST']}, |
|
992 | 996 | requirements=URL_NAME_REQUIREMENTS) |
|
993 | 997 | |
|
994 | 998 | rmap.connect('files_edit_home', |
|
995 | 999 | '/{repo_name}/edit/{revision}/{f_path}', |
|
996 | 1000 | controller='files', action='edit_home', revision='tip', |
|
997 | 1001 | f_path='', conditions={'function': check_repo}, |
|
998 | 1002 | requirements=URL_NAME_REQUIREMENTS) |
|
999 | 1003 | |
|
1000 | 1004 | rmap.connect('files_add', |
|
1001 | 1005 | '/{repo_name}/add/{revision}/{f_path}', |
|
1002 | 1006 | controller='files', action='add', revision='tip', |
|
1003 | 1007 | f_path='', |
|
1004 | 1008 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1005 | 1009 | requirements=URL_NAME_REQUIREMENTS) |
|
1006 | 1010 | |
|
1007 | 1011 | rmap.connect('files_add_home', |
|
1008 | 1012 | '/{repo_name}/add/{revision}/{f_path}', |
|
1009 | 1013 | controller='files', action='add_home', revision='tip', |
|
1010 | 1014 | f_path='', conditions={'function': check_repo}, |
|
1011 | 1015 | requirements=URL_NAME_REQUIREMENTS) |
|
1012 | 1016 | |
|
1013 | 1017 | rmap.connect('files_delete', |
|
1014 | 1018 | '/{repo_name}/delete/{revision}/{f_path}', |
|
1015 | 1019 | controller='files', action='delete', revision='tip', |
|
1016 | 1020 | f_path='', |
|
1017 | 1021 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1018 | 1022 | requirements=URL_NAME_REQUIREMENTS) |
|
1019 | 1023 | |
|
1020 | 1024 | rmap.connect('files_delete_home', |
|
1021 | 1025 | '/{repo_name}/delete/{revision}/{f_path}', |
|
1022 | 1026 | controller='files', action='delete_home', revision='tip', |
|
1023 | 1027 | f_path='', conditions={'function': check_repo}, |
|
1024 | 1028 | requirements=URL_NAME_REQUIREMENTS) |
|
1025 | 1029 | |
|
1026 | 1030 | rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}', |
|
1027 | 1031 | controller='files', action='archivefile', |
|
1028 | 1032 | conditions={'function': check_repo}, |
|
1029 | 1033 | requirements=URL_NAME_REQUIREMENTS) |
|
1030 | 1034 | |
|
1031 | 1035 | rmap.connect('files_nodelist_home', |
|
1032 | 1036 | '/{repo_name}/nodelist/{revision}/{f_path}', |
|
1033 | 1037 | controller='files', action='nodelist', |
|
1034 | 1038 | conditions={'function': check_repo}, |
|
1035 | 1039 | requirements=URL_NAME_REQUIREMENTS) |
|
1036 | 1040 | |
|
1037 | 1041 | rmap.connect('files_metadata_list_home', |
|
1038 | 1042 | '/{repo_name}/metadata_list/{revision}/{f_path}', |
|
1039 | 1043 | controller='files', action='metadata_list', |
|
1040 | 1044 | conditions={'function': check_repo}, |
|
1041 | 1045 | requirements=URL_NAME_REQUIREMENTS) |
|
1042 | 1046 | |
|
1043 | 1047 | rmap.connect('repo_fork_create_home', '/{repo_name}/fork', |
|
1044 | 1048 | controller='forks', action='fork_create', |
|
1045 | 1049 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1046 | 1050 | requirements=URL_NAME_REQUIREMENTS) |
|
1047 | 1051 | |
|
1048 | 1052 | rmap.connect('repo_fork_home', '/{repo_name}/fork', |
|
1049 | 1053 | controller='forks', action='fork', |
|
1050 | 1054 | conditions={'function': check_repo}, |
|
1051 | 1055 | requirements=URL_NAME_REQUIREMENTS) |
|
1052 | 1056 | |
|
1053 | 1057 | rmap.connect('repo_forks_home', '/{repo_name}/forks', |
|
1054 | 1058 | controller='forks', action='forks', |
|
1055 | 1059 | conditions={'function': check_repo}, |
|
1056 | 1060 | requirements=URL_NAME_REQUIREMENTS) |
|
1057 | 1061 | |
|
1058 | 1062 | rmap.connect('repo_followers_home', '/{repo_name}/followers', |
|
1059 | 1063 | controller='followers', action='followers', |
|
1060 | 1064 | conditions={'function': check_repo}, |
|
1061 | 1065 | requirements=URL_NAME_REQUIREMENTS) |
|
1062 | 1066 | |
|
1063 | 1067 | # must be here for proper group/repo catching pattern |
|
1064 | 1068 | _connect_with_slash( |
|
1065 | 1069 | rmap, 'repo_group_home', '/{group_name}', |
|
1066 | 1070 | controller='home', action='index_repo_group', |
|
1067 | 1071 | conditions={'function': check_group}, |
|
1068 | 1072 | requirements=URL_NAME_REQUIREMENTS) |
|
1069 | 1073 | |
|
1070 | 1074 | # catch all, at the end |
|
1071 | 1075 | _connect_with_slash( |
|
1072 | 1076 | rmap, 'summary_home', '/{repo_name}', |
|
1073 | 1077 | controller='summary', action='index', |
|
1074 | 1078 | conditions={'function': check_repo}, |
|
1075 | 1079 | requirements=URL_NAME_REQUIREMENTS) |
|
1076 | 1080 | |
|
1077 | 1081 | return rmap |
|
1078 | 1082 | |
|
1079 | 1083 | |
|
1080 | 1084 | def _connect_with_slash(mapper, name, path, *args, **kwargs): |
|
1081 | 1085 | """ |
|
1082 | 1086 | Connect a route with an optional trailing slash in `path`. |
|
1083 | 1087 | """ |
|
1084 | 1088 | mapper.connect(name + '_slash', path + '/', *args, **kwargs) |
|
1085 | 1089 | mapper.connect(name, path, *args, **kwargs) |
General Comments 0
You need to be logged in to leave comments.
Login now