Mercurial > kallithea
annotate pylons_app/config/routing.py @ 266:32d6c955218c
added check for repo created outside of hg app
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 07 Jun 2010 00:26:52 +0200 |
parents | fb7f066126cc |
children | d303aacb3349 |
rev | line source |
---|---|
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 | |
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 | 24 |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
25 #REST routes |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
26 with map.submapper(path_prefix='/_admin', controller='repos') as m: |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
27 m.connect("repos", "/repos", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
28 action="create", conditions=dict(method=["POST"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
29 m.connect("repos", "/repos", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
30 action="index", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
31 m.connect("formatted_repos", "/repos.{format}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
32 action="index", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
33 conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
34 m.connect("new_repo", "/repos/new", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
35 action="new", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
36 m.connect("formatted_new_repo", "/repos/new.{format}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
37 action="new", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
38 m.connect("/repos/{id:.*}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
39 action="update", conditions=dict(method=["PUT"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
40 m.connect("/repos/{id:.*}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
41 action="delete", conditions=dict(method=["DELETE"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
42 m.connect("edit_repo", "/repos/{id:.*}/edit", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
43 action="edit", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
44 m.connect("formatted_edit_repo", "/repos/{id:.*}.{format}/edit", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
45 action="edit", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
46 m.connect("repo", "/repos/{id:.*}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
47 action="show", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
48 m.connect("formatted_repo", "/repos/{id:.*}.{format}", |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
49 action="show", conditions=dict(method=["GET"])) |
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
50 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
44
diff
changeset
|
51 map.resource('user', 'users', path_prefix='/_admin') |
230
d982ed8e32d8
Admin templating updates, added rest permission controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
52 map.resource('permission', 'permissions', path_prefix='/_admin') |
55
e00dccb6f211
Implemented index page using vcs
Marcin Kuzminski <marcin@python-blog.com>
parents:
47
diff
changeset
|
53 |
92 | 54 #ADMIN |
70
9a2affee4a45
Updated defaults bug of htmlfill + changed routing
Marcin Kuzminski <marcin@python-blog.com>
parents:
55
diff
changeset
|
55 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
|
56 m.connect('admin_home', '/', action='index')#main page |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
148
diff
changeset
|
57 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
148
diff
changeset
|
58 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
|
59 |
205
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
181
diff
changeset
|
60 #FEEDS |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
61 map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss', |
205
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
181
diff
changeset
|
62 controller='feed', action='rss') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
63 map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom', |
205
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
181
diff
changeset
|
64 controller='feed', action='atom') |
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
181
diff
changeset
|
65 |
181
55c875d8608b
added login logout and annotate to urls
Marcin Kuzminski <marcin@python-works.com>
parents:
162
diff
changeset
|
66 map.connect('login_home', '/login', controller='login') |
55c875d8608b
added login logout and annotate to urls
Marcin Kuzminski <marcin@python-works.com>
parents:
162
diff
changeset
|
67 map.connect('logout_home', '/logout', controller='login', action='logout') |
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
|
68 |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
69 map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
70 controller='changeset', revision='tip') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
71 map.connect('summary_home', '/{repo_name:.*}/summary', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
72 controller='summary') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
73 map.connect('shortlog_home', '/{repo_name:.*}/shortlog', |
162
32e7e43ad754
removed unneeded parameters from changelog and shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
149
diff
changeset
|
74 controller='shortlog') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
75 map.connect('branches_home', '/{repo_name:.*}/branches', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
76 controller='branches') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
77 map.connect('tags_home', '/{repo_name:.*}/tags', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
78 controller='tags') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
79 map.connect('changelog_home', '/{repo_name:.*}/changelog', |
162
32e7e43ad754
removed unneeded parameters from changelog and shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
149
diff
changeset
|
80 controller='changelog') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
81 map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
82 controller='files', revision='tip', f_path='') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
83 map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
84 controller='files', action='diff', revision='tip', f_path='') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
85 map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', |
148
d928d5f0a251
Adde raw file to routes, and refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
142
diff
changeset
|
86 controller='files', action='rawfile', revision='tip', f_path='') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
87 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', |
181
55c875d8608b
added login logout and annotate to urls
Marcin Kuzminski <marcin@python-works.com>
parents:
162
diff
changeset
|
88 controller='files', action='annotate', revision='tip', f_path='') |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
230
diff
changeset
|
89 map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}', |
149
b3c93efd1c97
Updated template for summary (archives links)
Marcin Kuzminski <marcin@python-works.com>
parents:
148
diff
changeset
|
90 controller='files', action='archivefile', revision='tip') |
0 | 91 return map |