0
|
1 """Routes configuration
|
|
2
|
|
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
|
|
5 refer to the routes manual at http://routes.groovie.org/docs/
|
|
6 """
|
|
7 from routes import Mapper
|
|
8
|
43
|
9 def make_map(config):
|
0
|
10 """Create, configure and return the routes Mapper"""
|
43
|
11 map = Mapper(directory=config['pylons.paths']['controllers'],
|
|
12 always_scan=config['debug'])
|
0
|
13 map.minimization = False
|
43
|
14 map.explicit = False
|
0
|
15
|
|
16 # The ErrorController route (handles 404/500 error pages); it should
|
|
17 # likely stay at the top, ensuring it can always be resolved
|
43
|
18 map.connect('/error/{action}', controller='error')
|
|
19 map.connect('/error/{action}/{id}', controller='error')
|
0
|
20
|
|
21 # CUSTOM ROUTES HERE
|
43
|
22 with map.submapper(path_prefix='/_admin', controller='admin') as m:
|
|
23 m.connect('admin_home', '/', action='index')#main page
|
|
24 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
|
|
25 m.connect('admin_manage_users', '/manage_users', action='index')
|
|
26
|
|
27 map.connect('hg', '/{path_info:.*}', controller='hg',
|
|
28 action="view", path_info='/')
|
0
|
29
|
|
30 return map
|