annotate pylons_app/config/routing.py @ 8:3092016c6d0c

Changed to webapp, removed get from routes,
author Marcin Kuzminski
date Thu, 18 Feb 2010 17:36:43 +0100
parents ad0dd3904225
children 2e1247e62c5b
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 pylons import config
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
8 from routes import Mapper
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
9
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
10 def make_map():
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
11 """Create, configure and return the routes Mapper"""
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
12 map = Mapper(directory = config['pylons.paths']['controllers'],
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
13 always_scan = config['debug'])
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
14 map.minimization = False
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
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
18 map.connect('/error/{action}', controller = 'error')
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
19 map.connect('/error/{action}/{id}', controller = 'error')
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
20
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21 # CUSTOM ROUTES HERE
5
ad0dd3904225 added repo creation
Marcin Kuzminski
parents: 4
diff changeset
22 map.connect('hg_add', '/add/{new_repo:[a-z0-9\. _-]*}',
3
a205d4d7abfc routes for adding a repo
Marcin Kuzminski
parents: 0
diff changeset
23 controller = 'hg', action = 'add_repo')
a205d4d7abfc routes for adding a repo
Marcin Kuzminski
parents: 0
diff changeset
24 map.connect('hg', '/{path_info:.*}',
a205d4d7abfc routes for adding a repo
Marcin Kuzminski
parents: 0
diff changeset
25 controller = 'hg', action = "view",
8
3092016c6d0c Changed to webapp, removed get from routes,
Marcin Kuzminski
parents: 5
diff changeset
26 path_info = '/')
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
27
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
28 return map