Show More
@@ -1,56 +1,56 | |||||
1 | """Routes configuration |
|
1 | """Routes configuration | |
2 |
|
2 | |||
3 | The more specific and detailed routes should be defined first so they |
|
3 | The more specific and detailed routes should be defined first so they | |
4 | may take precedent over the more generic routes. For more information |
|
4 | may take precedent over the more generic routes. For more information | |
5 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
5 | refer to the routes manual at http://routes.groovie.org/docs/ | |
6 | """ |
|
6 | """ | |
7 | from routes import Mapper |
|
7 | from routes import Mapper | |
8 |
|
8 | |||
9 | def make_map(config): |
|
9 | def make_map(config): | |
10 | """Create, configure and return the routes Mapper""" |
|
10 | """Create, configure and return the routes Mapper""" | |
11 | map = Mapper(directory=config['pylons.paths']['controllers'], |
|
11 | map = Mapper(directory=config['pylons.paths']['controllers'], | |
12 | always_scan=config['debug']) |
|
12 | always_scan=config['debug']) | |
13 | map.minimization = False |
|
13 | map.minimization = False | |
14 | map.explicit = False |
|
14 | map.explicit = False | |
15 |
|
15 | |||
16 | # The ErrorController route (handles 404/500 error pages); it should |
|
16 | # The ErrorController route (handles 404/500 error pages); it should | |
17 | # likely stay at the top, ensuring it can always be resolved |
|
17 | # likely stay at the top, ensuring it can always be resolved | |
18 | map.connect('/error/{action}', controller='error') |
|
18 | map.connect('/error/{action}', controller='error') | |
19 | map.connect('/error/{action}/{id}', controller='error') |
|
19 | map.connect('/error/{action}/{id}', controller='error') | |
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 controllers | |
26 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
26 | map.resource('repo', 'repos', path_prefix='/_admin') | |
27 | map.resource('user', 'users', path_prefix='/_admin') |
|
27 | map.resource('user', 'users', path_prefix='/_admin') | |
28 |
|
28 | |||
29 | #ADMIN |
|
29 | #ADMIN | |
30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
|
30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: | |
31 | m.connect('admin_home', '/', action='index')#main page |
|
31 | m.connect('admin_home', '/', action='index')#main page | |
32 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
32 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
33 | action='add_repo') |
|
33 | action='add_repo') | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | map.connect('changeset_home', '/{repo_name}/changeset/{revision}', |
|
36 | map.connect('changeset_home', '/{repo_name}/changeset/{revision}', | |
37 | controller='changeset', revision='tip') |
|
37 | controller='changeset', revision='tip') | |
38 | map.connect('summary_home', '/{repo_name}/summary', |
|
38 | map.connect('summary_home', '/{repo_name}/summary', | |
39 | controller='summary') |
|
39 | controller='summary') | |
40 |
map.connect('shortlog_home', '/{repo_name}/shortlog/ |
|
40 | map.connect('shortlog_home', '/{repo_name}/shortlog/', | |
41 |
controller='shortlog' |
|
41 | controller='shortlog') | |
42 | map.connect('branches_home', '/{repo_name}/branches', |
|
42 | map.connect('branches_home', '/{repo_name}/branches', | |
43 | controller='branches') |
|
43 | controller='branches') | |
44 | map.connect('tags_home', '/{repo_name}/tags', |
|
44 | map.connect('tags_home', '/{repo_name}/tags', | |
45 | controller='tags') |
|
45 | controller='tags') | |
46 |
map.connect('changelog_home', '/{repo_name}/changelog |
|
46 | map.connect('changelog_home', '/{repo_name}/changelog', | |
47 |
controller='changelog' |
|
47 | controller='changelog') | |
48 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', |
|
48 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', | |
49 | controller='files', revision='tip', f_path='') |
|
49 | controller='files', revision='tip', f_path='') | |
50 | map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}', |
|
50 | map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}', | |
51 | controller='files', action='diff', revision='tip', f_path='') |
|
51 | controller='files', action='diff', revision='tip', f_path='') | |
52 | map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}', |
|
52 | map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}', | |
53 | controller='files', action='rawfile', revision='tip', f_path='') |
|
53 | controller='files', action='rawfile', revision='tip', f_path='') | |
54 | map.connect('files_archive_home', '/{repo_name}/archive/{revision}/{fileformat}', |
|
54 | map.connect('files_archive_home', '/{repo_name}/archive/{revision}/{fileformat}', | |
55 | controller='files', action='archivefile', revision='tip') |
|
55 | controller='files', action='archivefile', revision='tip') | |
56 | return map |
|
56 | return map |
General Comments 0
You need to be logged in to leave comments.
Login now