comparison rhodecode/config/routing.py @ 3098:a5f0bc867edc rhodecode-0.0.1.5.0

merge with beta
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 13 Dec 2012 22:54:21 +0100
parents d998cc84cf72 6104dfd35b16
children cd50d1b5f35b
comparison
equal deleted inserted replaced
2909:52b1c6de19c2 3098:a5f0bc867edc
29 :param environ: 29 :param environ:
30 :param match_dict: 30 :param match_dict:
31 """ 31 """
32 from rhodecode.model.db import Repository 32 from rhodecode.model.db import Repository
33 repo_name = match_dict.get('repo_name') 33 repo_name = match_dict.get('repo_name')
34
35 if match_dict.get('f_path'):
36 #fix for multiple initial slashes that causes errors
37 match_dict['f_path'] = match_dict['f_path'].lstrip('/')
34 38
35 try: 39 try:
36 by_id = repo_name.split('_') 40 by_id = repo_name.split('_')
37 if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '': 41 if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '':
38 repo_name = Repository.get(by_id[1]).repo_name 42 repo_name = Repository.get(by_id[1]).repo_name
256 260
257 #ADMIN PERMISSIONS REST ROUTES 261 #ADMIN PERMISSIONS REST ROUTES
258 rmap.resource('permission', 'permissions', 262 rmap.resource('permission', 'permissions',
259 controller='admin/permissions', path_prefix=ADMIN_PREFIX) 263 controller='admin/permissions', path_prefix=ADMIN_PREFIX)
260 264
265 #ADMIN DEFAULTS REST ROUTES
266 rmap.resource('default', 'defaults',
267 controller='admin/defaults', path_prefix=ADMIN_PREFIX)
268
261 ##ADMIN LDAP SETTINGS 269 ##ADMIN LDAP SETTINGS
262 rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX, 270 rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX,
263 controller='admin/ldap_settings', action='ldap_settings', 271 controller='admin/ldap_settings', action='ldap_settings',
264 conditions=dict(method=["POST"])) 272 conditions=dict(method=["POST"]))
265 273
345 with rmap.submapper(path_prefix=ADMIN_PREFIX, 353 with rmap.submapper(path_prefix=ADMIN_PREFIX,
346 controller='api/api') as m: 354 controller='api/api') as m:
347 m.connect('api', '/api') 355 m.connect('api', '/api')
348 356
349 #USER JOURNAL 357 #USER JOURNAL
358 rmap.connect('journal_my_repos', '%s/journal_my_repos' % ADMIN_PREFIX,
359 controller='journal', action='index_my_repos')
350 rmap.connect('journal', '%s/journal' % ADMIN_PREFIX, 360 rmap.connect('journal', '%s/journal' % ADMIN_PREFIX,
351 controller='journal', action='index') 361 controller='journal', action='index')
352 rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX, 362 rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX,
353 controller='journal', action='journal_rss') 363 controller='journal', action='journal_rss')
354 rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX, 364 rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX,
417 427
418 rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}', 428 rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}',
419 controller='changeset', revision='tip', 429 controller='changeset', revision='tip',
420 conditions=dict(function=check_repo)) 430 conditions=dict(function=check_repo))
421 431
432 #still working url for backward compat.
433 rmap.connect('raw_changeset_home_depraced',
434 '/{repo_name:.*?}/raw-changeset/{revision}',
435 controller='changeset', action='changeset_raw',
436 revision='tip', conditions=dict(function=check_repo))
437
438 ## new URLs
439 rmap.connect('changeset_raw_home',
440 '/{repo_name:.*?}/changeset-diff/{revision}',
441 controller='changeset', action='changeset_raw',
442 revision='tip', conditions=dict(function=check_repo))
443
444 rmap.connect('changeset_patch_home',
445 '/{repo_name:.*?}/changeset-patch/{revision}',
446 controller='changeset', action='changeset_patch',
447 revision='tip', conditions=dict(function=check_repo))
448
449 rmap.connect('changeset_download_home',
450 '/{repo_name:.*?}/changeset-download/{revision}',
451 controller='changeset', action='changeset_download',
452 revision='tip', conditions=dict(function=check_repo))
453
422 rmap.connect('changeset_comment', 454 rmap.connect('changeset_comment',
423 '/{repo_name:.*?}/changeset/{revision}/comment', 455 '/{repo_name:.*?}/changeset/{revision}/comment',
424 controller='changeset', revision='tip', action='comment', 456 controller='changeset', revision='tip', action='comment',
425 conditions=dict(function=check_repo)) 457 conditions=dict(function=check_repo))
426 458
427 rmap.connect('changeset_comment_delete', 459 rmap.connect('changeset_comment_delete',
428 '/{repo_name:.*?}/changeset/comment/{comment_id}/delete', 460 '/{repo_name:.*?}/changeset/comment/{comment_id}/delete',
429 controller='changeset', action='delete_comment', 461 controller='changeset', action='delete_comment',
430 conditions=dict(function=check_repo, method=["DELETE"])) 462 conditions=dict(function=check_repo, method=["DELETE"]))
431 463
432 rmap.connect('raw_changeset_home', 464 rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}',
433 '/{repo_name:.*?}/raw-changeset/{revision}', 465 controller='changeset', action='changeset_info')
434 controller='changeset', action='raw_changeset',
435 revision='tip', conditions=dict(function=check_repo))
436 466
437 rmap.connect('compare_url', 467 rmap.connect('compare_url',
438 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref}...{other_ref_type}@{other_ref}', 468 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}',
439 controller='compare', action='index', 469 controller='compare', action='index',
440 conditions=dict(function=check_repo), 470 conditions=dict(function=check_repo),
441 requirements=dict( 471 requirements=dict(
442 org_ref_type='(branch|book|tag|rev|org_ref_type)', 472 org_ref_type='(branch|book|tag|rev|org_ref_type)',
443 other_ref_type='(branch|book|tag|rev|other_ref_type)') 473 other_ref_type='(branch|book|tag|rev|other_ref_type)')
490 controller='summary', conditions=dict(function=check_repo)) 520 controller='summary', conditions=dict(function=check_repo))
491 521
492 rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog', 522 rmap.connect('shortlog_home', '/{repo_name:.*?}/shortlog',
493 controller='shortlog', conditions=dict(function=check_repo)) 523 controller='shortlog', conditions=dict(function=check_repo))
494 524
525 rmap.connect('shortlog_file_home', '/{repo_name:.*?}/shortlog/{revision}/{f_path:.*}',
526 controller='shortlog', f_path=None,
527 conditions=dict(function=check_repo))
528
495 rmap.connect('branches_home', '/{repo_name:.*?}/branches', 529 rmap.connect('branches_home', '/{repo_name:.*?}/branches',
496 controller='branches', conditions=dict(function=check_repo)) 530 controller='branches', conditions=dict(function=check_repo))
497 531
498 rmap.connect('tags_home', '/{repo_name:.*?}/tags', 532 rmap.connect('tags_home', '/{repo_name:.*?}/tags',
499 controller='tags', conditions=dict(function=check_repo)) 533 controller='tags', conditions=dict(function=check_repo))
509 conditions=dict(function=check_repo)) 543 conditions=dict(function=check_repo))
510 544
511 rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}', 545 rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}',
512 controller='files', revision='tip', f_path='', 546 controller='files', revision='tip', f_path='',
513 conditions=dict(function=check_repo)) 547 conditions=dict(function=check_repo))
548
549 rmap.connect('files_history_home',
550 '/{repo_name:.*?}/history/{revision}/{f_path:.*}',
551 controller='files', action='history', revision='tip', f_path='',
552 conditions=dict(function=check_repo))
514 553
515 rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}', 554 rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}',
516 controller='files', action='diff', revision='tip', f_path='', 555 controller='files', action='diff', revision='tip', f_path='',
517 conditions=dict(function=check_repo)) 556 conditions=dict(function=check_repo))
518 557