comparison pylons_app/config/routing.py @ 248:fb7f066126cc

Added support for repository located in subdirectories.
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 03 Jun 2010 20:28:46 +0200
parents d982ed8e32d8
children d303aacb3349
comparison
equal deleted inserted replaced
247:51434007e21d 248:fb7f066126cc
20 20
21 # CUSTOM ROUTES HERE 21 # CUSTOM ROUTES HERE
22 map.connect('hg_home', '/', controller='hg', action='index') 22 map.connect('hg_home', '/', controller='hg', action='index')
23 23
24 24
25 #REST controllers 25 #REST routes
26 map.resource('repo', 'repos', path_prefix='/_admin') 26 with map.submapper(path_prefix='/_admin', controller='repos') as m:
27 m.connect("repos", "/repos",
28 action="create", conditions=dict(method=["POST"]))
29 m.connect("repos", "/repos",
30 action="index", conditions=dict(method=["GET"]))
31 m.connect("formatted_repos", "/repos.{format}",
32 action="index",
33 conditions=dict(method=["GET"]))
34 m.connect("new_repo", "/repos/new",
35 action="new", conditions=dict(method=["GET"]))
36 m.connect("formatted_new_repo", "/repos/new.{format}",
37 action="new", conditions=dict(method=["GET"]))
38 m.connect("/repos/{id:.*}",
39 action="update", conditions=dict(method=["PUT"]))
40 m.connect("/repos/{id:.*}",
41 action="delete", conditions=dict(method=["DELETE"]))
42 m.connect("edit_repo", "/repos/{id:.*}/edit",
43 action="edit", conditions=dict(method=["GET"]))
44 m.connect("formatted_edit_repo", "/repos/{id:.*}.{format}/edit",
45 action="edit", conditions=dict(method=["GET"]))
46 m.connect("repo", "/repos/{id:.*}",
47 action="show", conditions=dict(method=["GET"]))
48 m.connect("formatted_repo", "/repos/{id:.*}.{format}",
49 action="show", conditions=dict(method=["GET"]))
50
27 map.resource('user', 'users', path_prefix='/_admin') 51 map.resource('user', 'users', path_prefix='/_admin')
28 map.resource('permission', 'permissions', path_prefix='/_admin') 52 map.resource('permission', 'permissions', path_prefix='/_admin')
29 53
30 #ADMIN 54 #ADMIN
31 with map.submapper(path_prefix='/_admin', controller='admin') as m: 55 with map.submapper(path_prefix='/_admin', controller='admin') as m:
32 m.connect('admin_home', '/', action='index')#main page 56 m.connect('admin_home', '/', action='index')#main page
33 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', 57 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
34 action='add_repo') 58 action='add_repo')
35 59
36 #FEEDS 60 #FEEDS
37 map.connect('rss_feed_home', '/{repo_name}/feed/rss', 61 map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss',
38 controller='feed', action='rss') 62 controller='feed', action='rss')
39 map.connect('atom_feed_home', '/{repo_name}/feed/atom', 63 map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom',
40 controller='feed', action='atom') 64 controller='feed', action='atom')
41 65
42 map.connect('login_home', '/login', controller='login') 66 map.connect('login_home', '/login', controller='login')
43 map.connect('logout_home', '/logout', controller='login', action='logout') 67 map.connect('logout_home', '/logout', controller='login', action='logout')
44 68
45 map.connect('changeset_home', '/{repo_name}/changeset/{revision}', 69 map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}',
46 controller='changeset', revision='tip') 70 controller='changeset', revision='tip')
47 map.connect('summary_home', '/{repo_name}/summary', 71 map.connect('summary_home', '/{repo_name:.*}/summary',
48 controller='summary') 72 controller='summary')
49 map.connect('shortlog_home', '/{repo_name}/shortlog', 73 map.connect('shortlog_home', '/{repo_name:.*}/shortlog',
50 controller='shortlog') 74 controller='shortlog')
51 map.connect('branches_home', '/{repo_name}/branches', 75 map.connect('branches_home', '/{repo_name:.*}/branches',
52 controller='branches') 76 controller='branches')
53 map.connect('tags_home', '/{repo_name}/tags', 77 map.connect('tags_home', '/{repo_name:.*}/tags',
54 controller='tags') 78 controller='tags')
55 map.connect('changelog_home', '/{repo_name}/changelog', 79 map.connect('changelog_home', '/{repo_name:.*}/changelog',
56 controller='changelog') 80 controller='changelog')
57 map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', 81 map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
58 controller='files', revision='tip', f_path='') 82 controller='files', revision='tip', f_path='')
59 map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}', 83 map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
60 controller='files', action='diff', revision='tip', f_path='') 84 controller='files', action='diff', revision='tip', f_path='')
61 map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}', 85 map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
62 controller='files', action='rawfile', revision='tip', f_path='') 86 controller='files', action='rawfile', revision='tip', f_path='')
63 map.connect('files_annotate_home', '/{repo_name}/annotate/{revision}/{f_path:.*}', 87 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
64 controller='files', action='annotate', revision='tip', f_path='') 88 controller='files', action='annotate', revision='tip', f_path='')
65 map.connect('files_archive_home', '/{repo_name}/archive/{revision}/{fileformat}', 89 map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}',
66 controller='files', action='archivefile', revision='tip') 90 controller='files', action='archivefile', revision='tip')
67 return map 91 return map