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