annotate pylons_app/config/routing.py @ 47:f6ac79182600

Added rest controllers for repos and users, templating changes + css fixes
author Marcin Kuzminski <marcin@python-blog.com>
date Wed, 07 Apr 2010 20:19:25 +0200
parents d924b931b488
children e00dccb6f211
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1 """Routes configuration
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
2
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
3 The more specific and detailed routes should be defined first so they
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
4 may take precedent over the more generic routes. For more information
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
5 refer to the routes manual at http://routes.groovie.org/docs/
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
6 """
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
7 from routes import Mapper
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
8
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
9 def make_map(config):
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
10 """Create, configure and return the routes Mapper"""
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
11 map = Mapper(directory=config['pylons.paths']['controllers'],
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
12 always_scan=config['debug'])
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
13 map.minimization = False
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
14 map.explicit = False
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
15
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
16 # The ErrorController route (handles 404/500 error pages); it should
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
17 # likely stay at the top, ensuring it can always be resolved
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
18 map.connect('/error/{action}', controller='error')
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
19 map.connect('/error/{action}/{id}', controller='error')
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
20
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21 # CUSTOM ROUTES HERE
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
22 with map.submapper(path_prefix='/_admin', controller='admin') as m:
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
23 m.connect('admin_home', '/', action='index')#main page
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
24 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents: 44
diff changeset
25
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents: 44
diff changeset
26 map.resource('repo', 'repos', path_prefix='/_admin')
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents: 44
diff changeset
27 map.resource('user', 'users', path_prefix='/_admin')
43
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
28
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
29 map.connect('hg', '/{path_info:.*}', controller='hg',
2e1247e62c5b changed for pylons 0.1 / 1.0
marcink
parents: 8
diff changeset
30 action="view", path_info='/')
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
31
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
32 return map