annotate pylons_app/config/routing.py @ 0:564e40829f80

initial commit.
author Marcin Kuzminski
date Thu, 18 Feb 2010 13:01:57 +0100
parents
children a205d4d7abfc
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
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
22 map.connect('hg', '/{path_info:.*}', controller = 'hg', action = "view",
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
23 path_info = '/', conditions = {'method':'GET'})
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
24
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
25 return map