##// END OF EJS Templates
fixed removed route during pep8ify
marcink -
r1214:a2dba935 beta
parent child Browse files
Show More
@@ -1,283 +1,285 b''
1 1 """
2 2 Routes configuration
3 3
4 4 The more specific and detailed routes should be defined first so they
5 5 may take precedent over the more generic routes. For more information
6 6 refer to the routes manual at http://routes.groovie.org/docs/
7 7 """
8 8 from __future__ import with_statement
9 9 from routes import Mapper
10 10 from rhodecode.lib.utils import check_repo_fast as cr
11 11
12 12
13 13 def make_map(config):
14 14 """Create, configure and return the routes Mapper"""
15 15 rmap = Mapper(directory=config['pylons.paths']['controllers'],
16 16 always_scan=config['debug'])
17 17 rmap.minimization = False
18 18 rmap.explicit = False
19 19
20 20 def check_repo(environ, match_dict):
21 21 """
22 22 check for valid repository for proper 404 handling
23 23 :param environ:
24 24 :param match_dict:
25 25 """
26 26 repo_name = match_dict.get('repo_name')
27 27 return not cr(repo_name, config['base_path'])
28 28
29 29 # The ErrorController route (handles 404/500 error pages); it should
30 30 # likely stay at the top, ensuring it can always be resolved
31 31 rmap.connect('/error/{action}', controller='error')
32 32 rmap.connect('/error/{action}/{id}', controller='error')
33 33
34 34 #==========================================================================
35 35 # CUSTOM ROUTES HERE
36 36 #==========================================================================
37 37
38 38 #MAIN PAGE
39 39 rmap.connect('home', '/', controller='home', action='index')
40 rmap.connect('repo_switcher', '/repos', controller='home',
41 action='repo_switcher')
40 42 rmap.connect('bugtracker',
41 43 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
42 44 _static=True)
43 45 rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
44 46
45 47 #ADMIN REPOSITORY REST ROUTES
46 48 with rmap.submapper(path_prefix='/_admin', controller='admin/repos') as m:
47 49 m.connect("repos", "/repos",
48 50 action="create", conditions=dict(method=["POST"]))
49 51 m.connect("repos", "/repos",
50 52 action="index", conditions=dict(method=["GET"]))
51 53 m.connect("formatted_repos", "/repos.{format}",
52 54 action="index",
53 55 conditions=dict(method=["GET"]))
54 56 m.connect("new_repo", "/repos/new",
55 57 action="new", conditions=dict(method=["GET"]))
56 58 m.connect("formatted_new_repo", "/repos/new.{format}",
57 59 action="new", conditions=dict(method=["GET"]))
58 60 m.connect("/repos/{repo_name:.*}",
59 61 action="update", conditions=dict(method=["PUT"],
60 62 function=check_repo))
61 63 m.connect("/repos/{repo_name:.*}",
62 64 action="delete", conditions=dict(method=["DELETE"],
63 65 function=check_repo))
64 66 m.connect("edit_repo", "/repos/{repo_name:.*}/edit",
65 67 action="edit", conditions=dict(method=["GET"],
66 68 function=check_repo))
67 69 m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit",
68 70 action="edit", conditions=dict(method=["GET"],
69 71 function=check_repo))
70 72 m.connect("repo", "/repos/{repo_name:.*}",
71 73 action="show", conditions=dict(method=["GET"],
72 74 function=check_repo))
73 75 m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}",
74 76 action="show", conditions=dict(method=["GET"],
75 77 function=check_repo))
76 78 #ajax delete repo perm user
77 79 m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}",
78 80 action="delete_perm_user", conditions=dict(method=["DELETE"],
79 81 function=check_repo))
80 82 #ajax delete repo perm users_group
81 83 m.connect('delete_repo_users_group',
82 84 "/repos_delete_users_group/{repo_name:.*}",
83 85 action="delete_perm_users_group",
84 86 conditions=dict(method=["DELETE"], function=check_repo))
85 87
86 88 #settings actions
87 89 m.connect('repo_stats', "/repos_stats/{repo_name:.*}",
88 90 action="repo_stats", conditions=dict(method=["DELETE"],
89 91 function=check_repo))
90 92 m.connect('repo_cache', "/repos_cache/{repo_name:.*}",
91 93 action="repo_cache", conditions=dict(method=["DELETE"],
92 94 function=check_repo))
93 95 m.connect('repo_public_journal',
94 96 "/repos_public_journal/{repo_name:.*}",
95 97 action="repo_public_journal", conditions=dict(method=["PUT"],
96 98 function=check_repo))
97 99 m.connect('repo_pull', "/repo_pull/{repo_name:.*}",
98 100 action="repo_pull", conditions=dict(method=["PUT"],
99 101 function=check_repo))
100 102
101 103 #ADMIN REPOS GROUP REST ROUTES
102 104 rmap.resource('repos_group', 'repos_groups',
103 105 controller='admin/repos_groups', path_prefix='/_admin')
104 106
105 107 #ADMIN USER REST ROUTES
106 108 rmap.resource('user', 'users', controller='admin/users',
107 109 path_prefix='/_admin')
108 110
109 111 #ADMIN USERS REST ROUTES
110 112 rmap.resource('users_group', 'users_groups',
111 113 controller='admin/users_groups', path_prefix='/_admin')
112 114
113 115 #ADMIN GROUP REST ROUTES
114 116 rmap.resource('group', 'groups', controller='admin/groups',
115 117 path_prefix='/_admin')
116 118
117 119 #ADMIN PERMISSIONS REST ROUTES
118 120 rmap.resource('permission', 'permissions',
119 121 controller='admin/permissions', path_prefix='/_admin')
120 122
121 123 ##ADMIN LDAP SETTINGS
122 124 rmap.connect('ldap_settings', '/_admin/ldap',
123 125 controller='admin/ldap_settings', action='ldap_settings',
124 126 conditions=dict(method=["POST"]))
125 127 rmap.connect('ldap_home', '/_admin/ldap',
126 128 controller='admin/ldap_settings')
127 129
128 130 #ADMIN SETTINGS REST ROUTES
129 131 with rmap.submapper(path_prefix='/_admin',
130 132 controller='admin/settings') as m:
131 133 m.connect("admin_settings", "/settings",
132 134 action="create", conditions=dict(method=["POST"]))
133 135 m.connect("admin_settings", "/settings",
134 136 action="index", conditions=dict(method=["GET"]))
135 137 m.connect("formatted_admin_settings", "/settings.{format}",
136 138 action="index", conditions=dict(method=["GET"]))
137 139 m.connect("admin_new_setting", "/settings/new",
138 140 action="new", conditions=dict(method=["GET"]))
139 141 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
140 142 action="new", conditions=dict(method=["GET"]))
141 143 m.connect("/settings/{setting_id}",
142 144 action="update", conditions=dict(method=["PUT"]))
143 145 m.connect("/settings/{setting_id}",
144 146 action="delete", conditions=dict(method=["DELETE"]))
145 147 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
146 148 action="edit", conditions=dict(method=["GET"]))
147 149 m.connect("formatted_admin_edit_setting",
148 150 "/settings/{setting_id}.{format}/edit",
149 151 action="edit", conditions=dict(method=["GET"]))
150 152 m.connect("admin_setting", "/settings/{setting_id}",
151 153 action="show", conditions=dict(method=["GET"]))
152 154 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
153 155 action="show", conditions=dict(method=["GET"]))
154 156 m.connect("admin_settings_my_account", "/my_account",
155 157 action="my_account", conditions=dict(method=["GET"]))
156 158 m.connect("admin_settings_my_account_update", "/my_account_update",
157 159 action="my_account_update", conditions=dict(method=["PUT"]))
158 160 m.connect("admin_settings_create_repository", "/create_repository",
159 161 action="create_repository", conditions=dict(method=["GET"]))
160 162
161 163 #ADMIN MAIN PAGES
162 164 with rmap.submapper(path_prefix='/_admin', controller='admin/admin') as m:
163 165 m.connect('admin_home', '', action='index')
164 166 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
165 167 action='add_repo')
166 168
167 169 #USER JOURNAL
168 170 rmap.connect('journal', '/_admin/journal', controller='journal')
169 171
170 172 rmap.connect('public_journal', '/_admin/public_journal',
171 173 controller='journal', action="public_journal")
172 174
173 175 rmap.connect('public_journal_rss', '/_admin/public_journal_rss',
174 176 controller='journal', action="public_journal_rss")
175 177
176 178 rmap.connect('public_journal_atom', '/_admin/public_journal_atom',
177 179 controller='journal', action="public_journal_atom")
178 180
179 181 rmap.connect('toggle_following', '/_admin/toggle_following',
180 182 controller='journal', action='toggle_following',
181 183 conditions=dict(method=["POST"]))
182 184
183 185 #SEARCH
184 186 rmap.connect('search', '/_admin/search', controller='search',)
185 187 rmap.connect('search_repo', '/_admin/search/{search_repo:.*}',
186 188 controller='search')
187 189
188 190 #LOGIN/LOGOUT/REGISTER/SIGN IN
189 191 rmap.connect('login_home', '/_admin/login', controller='login')
190 192 rmap.connect('logout_home', '/_admin/logout', controller='login',
191 193 action='logout')
192 194
193 195 rmap.connect('register', '/_admin/register', controller='login',
194 196 action='register')
195 197
196 198 rmap.connect('reset_password', '/_admin/password_reset',
197 199 controller='login', action='password_reset')
198 200
199 201 #FEEDS
200 202 rmap.connect('rss_feed_home', '/{repo_name:.*}/feed/rss',
201 203 controller='feed', action='rss',
202 204 conditions=dict(function=check_repo))
203 205
204 206 rmap.connect('atom_feed_home', '/{repo_name:.*}/feed/atom',
205 207 controller='feed', action='atom',
206 208 conditions=dict(function=check_repo))
207 209
208 210 #REPOSITORY ROUTES
209 211 rmap.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}',
210 212 controller='changeset', revision='tip',
211 213 conditions=dict(function=check_repo))
212 214
213 215 rmap.connect('raw_changeset_home',
214 216 '/{repo_name:.*}/raw-changeset/{revision}',
215 217 controller='changeset', action='raw_changeset',
216 218 revision='tip', conditions=dict(function=check_repo))
217 219
218 220 rmap.connect('summary_home', '/{repo_name:.*}',
219 221 controller='summary', conditions=dict(function=check_repo))
220 222
221 223 rmap.connect('summary_home', '/{repo_name:.*}/summary',
222 224 controller='summary', conditions=dict(function=check_repo))
223 225
224 226 rmap.connect('shortlog_home', '/{repo_name:.*}/shortlog',
225 227 controller='shortlog', conditions=dict(function=check_repo))
226 228
227 229 rmap.connect('branches_home', '/{repo_name:.*}/branches',
228 230 controller='branches', conditions=dict(function=check_repo))
229 231
230 232 rmap.connect('tags_home', '/{repo_name:.*}/tags',
231 233 controller='tags', conditions=dict(function=check_repo))
232 234
233 235 rmap.connect('changelog_home', '/{repo_name:.*}/changelog',
234 236 controller='changelog', conditions=dict(function=check_repo))
235 237
236 238 rmap.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
237 239 controller='files', revision='tip', f_path='',
238 240 conditions=dict(function=check_repo))
239 241
240 242 rmap.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
241 243 controller='files', action='diff', revision='tip', f_path='',
242 244 conditions=dict(function=check_repo))
243 245
244 246 rmap.connect('files_rawfile_home',
245 247 '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
246 248 controller='files', action='rawfile', revision='tip',
247 249 f_path='', conditions=dict(function=check_repo))
248 250
249 251 rmap.connect('files_raw_home',
250 252 '/{repo_name:.*}/raw/{revision}/{f_path:.*}',
251 253 controller='files', action='raw', revision='tip', f_path='',
252 254 conditions=dict(function=check_repo))
253 255
254 256 rmap.connect('files_annotate_home',
255 257 '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
256 258 controller='files', action='annotate', revision='tip',
257 259 f_path='', conditions=dict(function=check_repo))
258 260
259 261 rmap.connect('files_archive_home', '/{repo_name:.*}/archive/{fname}',
260 262 controller='files', action='archivefile',
261 263 conditions=dict(function=check_repo))
262 264
263 265 rmap.connect('repo_settings_delete', '/{repo_name:.*}/settings',
264 266 controller='settings', action="delete",
265 267 conditions=dict(method=["DELETE"], function=check_repo))
266 268
267 269 rmap.connect('repo_settings_update', '/{repo_name:.*}/settings',
268 270 controller='settings', action="update",
269 271 conditions=dict(method=["PUT"], function=check_repo))
270 272
271 273 rmap.connect('repo_settings_home', '/{repo_name:.*}/settings',
272 274 controller='settings', action='index',
273 275 conditions=dict(function=check_repo))
274 276
275 277 rmap.connect('repo_fork_create_home', '/{repo_name:.*}/fork',
276 278 controller='settings', action='fork_create',
277 279 conditions=dict(function=check_repo, method=["POST"]))
278 280
279 281 rmap.connect('repo_fork_home', '/{repo_name:.*}/fork',
280 282 controller='settings', action='fork',
281 283 conditions=dict(function=check_repo))
282 284
283 285 return rmap
General Comments 0
You need to be logged in to leave comments. Login now