annotate pylons_app/config/routing.py @ 148:d928d5f0a251

Adde raw file to routes, and refactoring updated link to raw file at file source template
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 11 May 2010 22:23:16 +0200
parents f7218849798a
children b3c93efd1c97
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
70
9a2affee4a45 Updated defaults bug of htmlfill + changed routing
Marcin Kuzminski <marcin@python-blog.com>
parents: 55
diff changeset
22 map.connect('hg_home', '/', controller='hg', action='index')
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents: 44
diff changeset
23
92
2968fb635787 updated routing
Marcin Kuzminski <marcin@python-works.com>
parents: 83
diff changeset
24
2968fb635787 updated routing
Marcin Kuzminski <marcin@python-works.com>
parents: 83
diff changeset
25 #REST controllers
47
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')
55
e00dccb6f211 Implemented index page using vcs
Marcin Kuzminski <marcin@python-blog.com>
parents: 47
diff changeset
28
92
2968fb635787 updated routing
Marcin Kuzminski <marcin@python-works.com>
parents: 83
diff changeset
29 #ADMIN
70
9a2affee4a45 Updated defaults bug of htmlfill + changed routing
Marcin Kuzminski <marcin@python-blog.com>
parents: 55
diff changeset
30 with map.submapper(path_prefix='/_admin', controller='admin') as m:
9a2affee4a45 Updated defaults bug of htmlfill + changed routing
Marcin Kuzminski <marcin@python-blog.com>
parents: 55
diff changeset
31 m.connect('admin_home', '/', action='index')#main page
9a2affee4a45 Updated defaults bug of htmlfill + changed routing
Marcin Kuzminski <marcin@python-blog.com>
parents: 55
diff changeset
32 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
74
cdf4fda66dd9 Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents: 70
diff changeset
33
cdf4fda66dd9 Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents: 70
diff changeset
34
148
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
35 map.connect('changeset_home', '/{repo_name}/changeset/{revision}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
36 controller='changeset', revision='tip')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
37 map.connect('summary_home', '/{repo_name}/summary',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
38 controller='summary')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
39 map.connect('shortlog_home', '/{repo_name}/shortlog/{revision}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
40 controller='shortlog', revision='tip')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
41 map.connect('branches_home', '/{repo_name}/branches',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
42 controller='branches')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
43 map.connect('tags_home', '/{repo_name}/tags',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
44 controller='tags')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
45 map.connect('changelog_home', '/{repo_name}/changelog/{revision}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
46 controller='changelog', revision='tip')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
47 map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
48 controller='files', revision='tip', f_path='')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
49 map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
50 controller='files', action='diff', revision='tip', f_path='')
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
51 map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}',
d928d5f0a251 Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 142
diff changeset
52 controller='files', action='rawfile', revision='tip', f_path='')
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
53 return map