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