##// END OF EJS Templates
renamed gists routing to proper plural names
marcink -
r3882:2c5ceb54 beta
parent child Browse files
Show More
@@ -1,708 +1,708 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
11 11 # prefix for non repository related links needs to be prefixed with `/`
12 12 ADMIN_PREFIX = '/_admin'
13 13
14 14
15 15 def make_map(config):
16 16 """Create, configure and return the routes Mapper"""
17 17 rmap = Mapper(directory=config['pylons.paths']['controllers'],
18 18 always_scan=config['debug'])
19 19 rmap.minimization = False
20 20 rmap.explicit = False
21 21
22 22 from rhodecode.lib.utils import is_valid_repo
23 23 from rhodecode.lib.utils import is_valid_repos_group
24 24
25 25 def check_repo(environ, match_dict):
26 26 """
27 27 check for valid repository for proper 404 handling
28 28
29 29 :param environ:
30 30 :param match_dict:
31 31 """
32 32 from rhodecode.model.db import Repository
33 33 repo_name = match_dict.get('repo_name')
34 34
35 35 if match_dict.get('f_path'):
36 36 #fix for multiple initial slashes that causes errors
37 37 match_dict['f_path'] = match_dict['f_path'].lstrip('/')
38 38
39 39 try:
40 40 by_id = repo_name.split('_')
41 41 if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '':
42 42 repo_name = Repository.get(by_id[1]).repo_name
43 43 match_dict['repo_name'] = repo_name
44 44 except Exception:
45 45 pass
46 46
47 47 return is_valid_repo(repo_name, config['base_path'])
48 48
49 49 def check_group(environ, match_dict):
50 50 """
51 51 check for valid repository group for proper 404 handling
52 52
53 53 :param environ:
54 54 :param match_dict:
55 55 """
56 56 repos_group_name = match_dict.get('group_name')
57 57 return is_valid_repos_group(repos_group_name, config['base_path'])
58 58
59 59 def check_group_skip_path(environ, match_dict):
60 60 """
61 61 check for valid repository group for proper 404 handling, but skips
62 62 verification of existing path
63 63
64 64 :param environ:
65 65 :param match_dict:
66 66 """
67 67 repos_group_name = match_dict.get('group_name')
68 68 return is_valid_repos_group(repos_group_name, config['base_path'],
69 69 skip_path_check=True)
70 70
71 71 def check_user_group(environ, match_dict):
72 72 """
73 73 check for valid user group for proper 404 handling
74 74
75 75 :param environ:
76 76 :param match_dict:
77 77 """
78 78 return True
79 79
80 80 def check_int(environ, match_dict):
81 81 return match_dict.get('id').isdigit()
82 82
83 83 # The ErrorController route (handles 404/500 error pages); it should
84 84 # likely stay at the top, ensuring it can always be resolved
85 85 rmap.connect('/error/{action}', controller='error')
86 86 rmap.connect('/error/{action}/{id}', controller='error')
87 87
88 88 #==========================================================================
89 89 # CUSTOM ROUTES HERE
90 90 #==========================================================================
91 91
92 92 #MAIN PAGE
93 93 rmap.connect('home', '/', controller='home', action='index')
94 94 rmap.connect('repo_switcher', '/repos', controller='home',
95 95 action='repo_switcher')
96 96 rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*?}',
97 97 controller='home', action='branch_tag_switcher')
98 98 rmap.connect('bugtracker',
99 99 "http://bitbucket.org/marcinkuzminski/rhodecode/issues",
100 100 _static=True)
101 101 rmap.connect('rst_help',
102 102 "http://docutils.sourceforge.net/docs/user/rst/quickref.html",
103 103 _static=True)
104 104 rmap.connect('rhodecode_official', "http://rhodecode.org", _static=True)
105 105
106 106 #ADMIN REPOSITORY REST ROUTES
107 107 with rmap.submapper(path_prefix=ADMIN_PREFIX,
108 108 controller='admin/repos') as m:
109 109 m.connect("repos", "/repos",
110 110 action="create", conditions=dict(method=["POST"]))
111 111 m.connect("repos", "/repos",
112 112 action="index", conditions=dict(method=["GET"]))
113 113 m.connect("formatted_repos", "/repos.{format}",
114 114 action="index",
115 115 conditions=dict(method=["GET"]))
116 116 m.connect("new_repo", "/create_repository",
117 117 action="create_repository", conditions=dict(method=["GET"]))
118 118 m.connect("/repos/{repo_name:.*?}",
119 119 action="update", conditions=dict(method=["PUT"],
120 120 function=check_repo))
121 121 m.connect("/repos/{repo_name:.*?}",
122 122 action="delete", conditions=dict(method=["DELETE"],
123 123 function=check_repo))
124 124 m.connect("formatted_edit_repo", "/repos/{repo_name:.*?}.{format}/edit",
125 125 action="edit", conditions=dict(method=["GET"],
126 126 function=check_repo))
127 127 m.connect("repo", "/repos/{repo_name:.*?}",
128 128 action="show", conditions=dict(method=["GET"],
129 129 function=check_repo))
130 130 m.connect("formatted_repo", "/repos/{repo_name:.*?}.{format}",
131 131 action="show", conditions=dict(method=["GET"],
132 132 function=check_repo))
133 133 #add repo perm member
134 134 m.connect('set_repo_perm_member',
135 135 "/repos/{repo_name:.*?}/grant_perm",
136 136 action="set_repo_perm_member",
137 137 conditions=dict(method=["POST"], function=check_repo))
138 138
139 139 #ajax delete repo perm user
140 140 m.connect('delete_repo_perm_member',
141 141 "/repos/{repo_name:.*?}/revoke_perm",
142 142 action="delete_repo_perm_member",
143 143 conditions=dict(method=["DELETE"], function=check_repo))
144 144
145 145 #settings actions
146 146 m.connect('repo_stats', "/repos_stats/{repo_name:.*?}",
147 147 action="repo_stats", conditions=dict(method=["DELETE"],
148 148 function=check_repo))
149 149 m.connect('repo_cache', "/repos_cache/{repo_name:.*?}",
150 150 action="repo_cache", conditions=dict(method=["DELETE"],
151 151 function=check_repo))
152 152 m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*?}",
153 153 action="repo_public_journal", conditions=dict(method=["PUT"],
154 154 function=check_repo))
155 155 m.connect('repo_pull', "/repo_pull/{repo_name:.*?}",
156 156 action="repo_pull", conditions=dict(method=["PUT"],
157 157 function=check_repo))
158 158 m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*?}",
159 159 action="repo_as_fork", conditions=dict(method=["PUT"],
160 160 function=check_repo))
161 161 m.connect('repo_locking', "/repo_locking/{repo_name:.*?}",
162 162 action="repo_locking", conditions=dict(method=["PUT"],
163 163 function=check_repo))
164 164 m.connect('toggle_locking', "/locking_toggle/{repo_name:.*?}",
165 165 action="toggle_locking", conditions=dict(method=["GET"],
166 166 function=check_repo))
167 167
168 168 #repo fields
169 169 m.connect('create_repo_fields', "/repo_fields/{repo_name:.*?}/new",
170 170 action="create_repo_field", conditions=dict(method=["PUT"],
171 171 function=check_repo))
172 172
173 173 m.connect('delete_repo_fields', "/repo_fields/{repo_name:.*?}/{field_id}",
174 174 action="delete_repo_field", conditions=dict(method=["DELETE"],
175 175 function=check_repo))
176 176
177 177 with rmap.submapper(path_prefix=ADMIN_PREFIX,
178 178 controller='admin/repos_groups') as m:
179 179 m.connect("repos_groups", "/repos_groups",
180 180 action="create", conditions=dict(method=["POST"]))
181 181 m.connect("repos_groups", "/repos_groups",
182 182 action="index", conditions=dict(method=["GET"]))
183 183 m.connect("formatted_repos_groups", "/repos_groups.{format}",
184 184 action="index", conditions=dict(method=["GET"]))
185 185 m.connect("new_repos_group", "/repos_groups/new",
186 186 action="new", conditions=dict(method=["GET"]))
187 187 m.connect("formatted_new_repos_group", "/repos_groups/new.{format}",
188 188 action="new", conditions=dict(method=["GET"]))
189 189 m.connect("update_repos_group", "/repos_groups/{group_name:.*?}",
190 190 action="update", conditions=dict(method=["PUT"],
191 191 function=check_group))
192 192 #add repo group perm member
193 193 m.connect('set_repo_group_perm_member',
194 194 "/repos_groups/{group_name:.*?}/grant_perm",
195 195 action="set_repo_group_perm_member",
196 196 conditions=dict(method=["POST"], function=check_group))
197 197
198 198 #ajax delete repo group perm
199 199 m.connect('delete_repo_group_perm_member',
200 200 "/repos_groups/{group_name:.*?}/revoke_perm",
201 201 action="delete_repo_group_perm_member",
202 202 conditions=dict(method=["DELETE"], function=check_group))
203 203
204 204 m.connect("delete_repos_group", "/repos_groups/{group_name:.*?}",
205 205 action="delete", conditions=dict(method=["DELETE"],
206 206 function=check_group_skip_path))
207 207 m.connect("edit_repos_group", "/repos_groups/{group_name:.*?}/edit",
208 208 action="edit", conditions=dict(method=["GET"],
209 209 function=check_group))
210 210 m.connect("formatted_edit_repos_group",
211 211 "/repos_groups/{group_name:.*?}.{format}/edit",
212 212 action="edit", conditions=dict(method=["GET"],
213 213 function=check_group))
214 214 m.connect("repos_group", "/repos_groups/{group_name:.*?}",
215 215 action="show", conditions=dict(method=["GET"],
216 216 function=check_group))
217 217 m.connect("formatted_repos_group", "/repos_groups/{group_name:.*?}.{format}",
218 218 action="show", conditions=dict(method=["GET"],
219 219 function=check_group))
220 220
221 221 #ADMIN USER REST ROUTES
222 222 with rmap.submapper(path_prefix=ADMIN_PREFIX,
223 223 controller='admin/users') as m:
224 224 m.connect("users", "/users",
225 225 action="create", conditions=dict(method=["POST"]))
226 226 m.connect("users", "/users",
227 227 action="index", conditions=dict(method=["GET"]))
228 228 m.connect("formatted_users", "/users.{format}",
229 229 action="index", conditions=dict(method=["GET"]))
230 230 m.connect("new_user", "/users/new",
231 231 action="new", conditions=dict(method=["GET"]))
232 232 m.connect("formatted_new_user", "/users/new.{format}",
233 233 action="new", conditions=dict(method=["GET"]))
234 234 m.connect("update_user", "/users/{id}",
235 235 action="update", conditions=dict(method=["PUT"]))
236 236 m.connect("delete_user", "/users/{id}",
237 237 action="delete", conditions=dict(method=["DELETE"]))
238 238 m.connect("edit_user", "/users/{id}/edit",
239 239 action="edit", conditions=dict(method=["GET"]))
240 240 m.connect("formatted_edit_user",
241 241 "/users/{id}.{format}/edit",
242 242 action="edit", conditions=dict(method=["GET"]))
243 243 m.connect("user", "/users/{id}",
244 244 action="show", conditions=dict(method=["GET"]))
245 245 m.connect("formatted_user", "/users/{id}.{format}",
246 246 action="show", conditions=dict(method=["GET"]))
247 247
248 248 #EXTRAS USER ROUTES
249 249 m.connect("user_perm", "/users_perm/{id}",
250 250 action="update_perm", conditions=dict(method=["PUT"]))
251 251 m.connect("user_emails", "/users_emails/{id}",
252 252 action="add_email", conditions=dict(method=["PUT"]))
253 253 m.connect("user_emails_delete", "/users_emails/{id}",
254 254 action="delete_email", conditions=dict(method=["DELETE"]))
255 255 m.connect("user_ips", "/users_ips/{id}",
256 256 action="add_ip", conditions=dict(method=["PUT"]))
257 257 m.connect("user_ips_delete", "/users_ips/{id}",
258 258 action="delete_ip", conditions=dict(method=["DELETE"]))
259 259
260 260 #ADMIN USER GROUPS REST ROUTES
261 261 with rmap.submapper(path_prefix=ADMIN_PREFIX,
262 262 controller='admin/users_groups') as m:
263 263 m.connect("users_groups", "/users_groups",
264 264 action="create", conditions=dict(method=["POST"]))
265 265 m.connect("users_groups", "/users_groups",
266 266 action="index", conditions=dict(method=["GET"]))
267 267 m.connect("formatted_users_groups", "/users_groups.{format}",
268 268 action="index", conditions=dict(method=["GET"]))
269 269 m.connect("new_users_group", "/users_groups/new",
270 270 action="new", conditions=dict(method=["GET"]))
271 271 m.connect("formatted_new_users_group", "/users_groups/new.{format}",
272 272 action="new", conditions=dict(method=["GET"]))
273 273 m.connect("update_users_group", "/users_groups/{id}",
274 274 action="update", conditions=dict(method=["PUT"]))
275 275 m.connect("delete_users_group", "/users_groups/{id}",
276 276 action="delete", conditions=dict(method=["DELETE"]))
277 277 m.connect("edit_users_group", "/users_groups/{id}/edit",
278 278 action="edit", conditions=dict(method=["GET"]),
279 279 function=check_user_group)
280 280 m.connect("formatted_edit_users_group",
281 281 "/users_groups/{id}.{format}/edit",
282 282 action="edit", conditions=dict(method=["GET"]))
283 283 m.connect("users_group", "/users_groups/{id}",
284 284 action="show", conditions=dict(method=["GET"]))
285 285 m.connect("formatted_users_group", "/users_groups/{id}.{format}",
286 286 action="show", conditions=dict(method=["GET"]))
287 287
288 288 #EXTRAS USER ROUTES
289 289 # update
290 290 m.connect("users_group_perm", "/users_groups/{id}/update_global_perm",
291 291 action="update_perm", conditions=dict(method=["PUT"]))
292 292
293 293 #add user group perm member
294 294 m.connect('set_user_group_perm_member', "/users_groups/{id}/grant_perm",
295 295 action="set_user_group_perm_member",
296 296 conditions=dict(method=["POST"]))
297 297
298 298 #ajax delete user group perm
299 299 m.connect('delete_user_group_perm_member', "/users_groups/{id}/revoke_perm",
300 300 action="delete_user_group_perm_member",
301 301 conditions=dict(method=["DELETE"]))
302 302
303 303 #ADMIN GROUP REST ROUTES
304 304 rmap.resource('group', 'groups',
305 305 controller='admin/groups', path_prefix=ADMIN_PREFIX)
306 306
307 307 #ADMIN PERMISSIONS REST ROUTES
308 308 rmap.resource('permission', 'permissions',
309 309 controller='admin/permissions', path_prefix=ADMIN_PREFIX)
310 310
311 311 #ADMIN DEFAULTS REST ROUTES
312 312 rmap.resource('default', 'defaults',
313 313 controller='admin/defaults', path_prefix=ADMIN_PREFIX)
314 314
315 315 ##ADMIN LDAP SETTINGS
316 316 rmap.connect('ldap_settings', '%s/ldap' % ADMIN_PREFIX,
317 317 controller='admin/ldap_settings', action='ldap_settings',
318 318 conditions=dict(method=["POST"]))
319 319
320 320 rmap.connect('ldap_home', '%s/ldap' % ADMIN_PREFIX,
321 321 controller='admin/ldap_settings')
322 322
323 323 #ADMIN SETTINGS REST ROUTES
324 324 with rmap.submapper(path_prefix=ADMIN_PREFIX,
325 325 controller='admin/settings') as m:
326 326 m.connect("admin_settings", "/settings",
327 327 action="create", conditions=dict(method=["POST"]))
328 328 m.connect("admin_settings", "/settings",
329 329 action="index", conditions=dict(method=["GET"]))
330 330 m.connect("formatted_admin_settings", "/settings.{format}",
331 331 action="index", conditions=dict(method=["GET"]))
332 332 m.connect("admin_new_setting", "/settings/new",
333 333 action="new", conditions=dict(method=["GET"]))
334 334 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
335 335 action="new", conditions=dict(method=["GET"]))
336 336 m.connect("/settings/{setting_id}",
337 337 action="update", conditions=dict(method=["PUT"]))
338 338 m.connect("/settings/{setting_id}",
339 339 action="delete", conditions=dict(method=["DELETE"]))
340 340 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
341 341 action="edit", conditions=dict(method=["GET"]))
342 342 m.connect("formatted_admin_edit_setting",
343 343 "/settings/{setting_id}.{format}/edit",
344 344 action="edit", conditions=dict(method=["GET"]))
345 345 m.connect("admin_setting", "/settings/{setting_id}",
346 346 action="show", conditions=dict(method=["GET"]))
347 347 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
348 348 action="show", conditions=dict(method=["GET"]))
349 349 m.connect("admin_settings_my_account", "/my_account",
350 350 action="my_account", conditions=dict(method=["GET"]))
351 351 m.connect("admin_settings_my_account_update", "/my_account_update",
352 352 action="my_account_update", conditions=dict(method=["PUT"]))
353 353 m.connect("admin_settings_my_repos", "/my_account/repos",
354 354 action="my_account_my_repos", conditions=dict(method=["GET"]))
355 355 m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests",
356 356 action="my_account_my_pullrequests", conditions=dict(method=["GET"]))
357 357
358 358 #NOTIFICATION REST ROUTES
359 359 with rmap.submapper(path_prefix=ADMIN_PREFIX,
360 360 controller='admin/notifications') as m:
361 361 m.connect("notifications", "/notifications",
362 362 action="create", conditions=dict(method=["POST"]))
363 363 m.connect("notifications", "/notifications",
364 364 action="index", conditions=dict(method=["GET"]))
365 365 m.connect("notifications_mark_all_read", "/notifications/mark_all_read",
366 366 action="mark_all_read", conditions=dict(method=["GET"]))
367 367 m.connect("formatted_notifications", "/notifications.{format}",
368 368 action="index", conditions=dict(method=["GET"]))
369 369 m.connect("new_notification", "/notifications/new",
370 370 action="new", conditions=dict(method=["GET"]))
371 371 m.connect("formatted_new_notification", "/notifications/new.{format}",
372 372 action="new", conditions=dict(method=["GET"]))
373 m.connect("/notification/{notification_id}",
373 m.connect("/notifications/{notification_id}",
374 374 action="update", conditions=dict(method=["PUT"]))
375 m.connect("/notification/{notification_id}",
375 m.connect("/notifications/{notification_id}",
376 376 action="delete", conditions=dict(method=["DELETE"]))
377 m.connect("edit_notification", "/notification/{notification_id}/edit",
377 m.connect("edit_notification", "/notifications/{notification_id}/edit",
378 378 action="edit", conditions=dict(method=["GET"]))
379 379 m.connect("formatted_edit_notification",
380 "/notification/{notification_id}.{format}/edit",
380 "/notifications/{notification_id}.{format}/edit",
381 381 action="edit", conditions=dict(method=["GET"]))
382 m.connect("notification", "/notification/{notification_id}",
382 m.connect("notification", "/notifications/{notification_id}",
383 383 action="show", conditions=dict(method=["GET"]))
384 m.connect("formatted_notification", "/notification/{notification_id}.{format}",
384 m.connect("formatted_notification", "/notifications/{notification_id}.{format}",
385 385 action="show", conditions=dict(method=["GET"]))
386 386
387 387 #ADMIN GIST
388 388 with rmap.submapper(path_prefix=ADMIN_PREFIX,
389 389 controller='admin/gists') as m:
390 390 m.connect("gists", "/gists",
391 391 action="create", conditions=dict(method=["POST"]))
392 392 m.connect("gists", "/gists",
393 393 action="index", conditions=dict(method=["GET"]))
394 394 m.connect("new_gist", "/gists/new",
395 395 action="new", conditions=dict(method=["GET"]))
396 m.connect("formatted_new_gist", "/gists/new/{format}",
396 m.connect("formatted_new_gist", "/gists/new.{format}",
397 397 action="new", conditions=dict(method=["GET"]))
398 m.connect("formatted_gists", "/gists/{format}",
398 m.connect("formatted_gists", "/gists.{format}",
399 399 action="index", conditions=dict(method=["GET"]))
400 m.connect("/gist/{gist_id}",
400 m.connect("/gists/{gist_id}",
401 401 action="update", conditions=dict(method=["PUT"]))
402 m.connect("/gist/{gist_id}",
402 m.connect("/gists/{gist_id}",
403 403 action="delete", conditions=dict(method=["DELETE"]))
404 m.connect("edit_gist", "/gist/{gist_id}/edit",
404 m.connect("edit_gist", "/gists/{gist_id}/edit",
405 405 action="edit", conditions=dict(method=["GET"]))
406 406 m.connect("formatted_edit_gist",
407 "/gist/{gist_id}/{format}/edit",
407 "/gists/{gist_id}/{format}/edit",
408 408 action="edit", conditions=dict(method=["GET"]))
409 m.connect("gist", "/gist/{gist_id}",
409 m.connect("gist", "/gists/{gist_id}",
410 410 action="show", conditions=dict(method=["GET"]))
411 m.connect("formatted_gist", "/gist/{gist_id}/{format}",
411 m.connect("formatted_gist", "/gists/{gist_id}/{format}",
412 412 action="show", conditions=dict(method=["GET"]))
413 m.connect("formatted_gist_file", "/gist/{gist_id}/{format}/{revision}/{f_path:.*}",
413 m.connect("formatted_gist_file", "/gists/{gist_id}/{format}/{revision}/{f_path:.*}",
414 414 action="show", conditions=dict(method=["GET"]))
415 415
416 416 #ADMIN MAIN PAGES
417 417 with rmap.submapper(path_prefix=ADMIN_PREFIX,
418 418 controller='admin/admin') as m:
419 419 m.connect('admin_home', '', action='index')
420 420 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
421 421 action='add_repo')
422 422 #==========================================================================
423 423 # API V2
424 424 #==========================================================================
425 425 with rmap.submapper(path_prefix=ADMIN_PREFIX,
426 426 controller='api/api') as m:
427 427 m.connect('api', '/api')
428 428
429 429 #USER JOURNAL
430 430 rmap.connect('journal', '%s/journal' % ADMIN_PREFIX,
431 431 controller='journal', action='index')
432 432 rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX,
433 433 controller='journal', action='journal_rss')
434 434 rmap.connect('journal_atom', '%s/journal/atom' % ADMIN_PREFIX,
435 435 controller='journal', action='journal_atom')
436 436
437 437 rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX,
438 438 controller='journal', action="public_journal")
439 439
440 440 rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX,
441 441 controller='journal', action="public_journal_rss")
442 442
443 443 rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX,
444 444 controller='journal', action="public_journal_rss")
445 445
446 446 rmap.connect('public_journal_atom',
447 447 '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal',
448 448 action="public_journal_atom")
449 449
450 450 rmap.connect('public_journal_atom_old',
451 451 '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal',
452 452 action="public_journal_atom")
453 453
454 454 rmap.connect('toggle_following', '%s/toggle_following' % ADMIN_PREFIX,
455 455 controller='journal', action='toggle_following',
456 456 conditions=dict(method=["POST"]))
457 457
458 458 #SEARCH
459 459 rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',)
460 460 rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX,
461 461 controller='search',
462 462 conditions=dict(function=check_repo))
463 463 rmap.connect('search_repo', '/{repo_name:.*?}/search',
464 464 controller='search',
465 465 conditions=dict(function=check_repo),
466 466 )
467 467
468 468 #LOGIN/LOGOUT/REGISTER/SIGN IN
469 469 rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login')
470 470 rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login',
471 471 action='logout')
472 472
473 473 rmap.connect('register', '%s/register' % ADMIN_PREFIX, controller='login',
474 474 action='register')
475 475
476 476 rmap.connect('reset_password', '%s/password_reset' % ADMIN_PREFIX,
477 477 controller='login', action='password_reset')
478 478
479 479 rmap.connect('reset_password_confirmation',
480 480 '%s/password_reset_confirmation' % ADMIN_PREFIX,
481 481 controller='login', action='password_reset_confirmation')
482 482
483 483 #FEEDS
484 484 rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss',
485 485 controller='feed', action='rss',
486 486 conditions=dict(function=check_repo))
487 487
488 488 rmap.connect('atom_feed_home', '/{repo_name:.*?}/feed/atom',
489 489 controller='feed', action='atom',
490 490 conditions=dict(function=check_repo))
491 491
492 492 #==========================================================================
493 493 # REPOSITORY ROUTES
494 494 #==========================================================================
495 495 rmap.connect('summary_home', '/{repo_name:.*?}',
496 496 controller='summary',
497 497 conditions=dict(function=check_repo))
498 498
499 499 rmap.connect('repo_size', '/{repo_name:.*?}/repo_size',
500 500 controller='summary', action='repo_size',
501 501 conditions=dict(function=check_repo))
502 502
503 503 rmap.connect('repos_group_home', '/{group_name:.*}',
504 504 controller='admin/repos_groups', action="show_by_name",
505 505 conditions=dict(function=check_group))
506 506
507 507 rmap.connect('changeset_home', '/{repo_name:.*?}/changeset/{revision}',
508 508 controller='changeset', revision='tip',
509 509 conditions=dict(function=check_repo))
510 510
511 511 # no longer user, but kept for routes to work
512 512 rmap.connect("_edit_repo", "/{repo_name:.*?}/edit",
513 513 controller='admin/repos', action="edit",
514 514 conditions=dict(method=["GET"], function=check_repo)
515 515 )
516 516
517 517 rmap.connect("edit_repo", "/{repo_name:.*?}/settings",
518 518 controller='admin/repos', action="edit",
519 519 conditions=dict(method=["GET"], function=check_repo)
520 520 )
521 521
522 522 #still working url for backward compat.
523 523 rmap.connect('raw_changeset_home_depraced',
524 524 '/{repo_name:.*?}/raw-changeset/{revision}',
525 525 controller='changeset', action='changeset_raw',
526 526 revision='tip', conditions=dict(function=check_repo))
527 527
528 528 ## new URLs
529 529 rmap.connect('changeset_raw_home',
530 530 '/{repo_name:.*?}/changeset-diff/{revision}',
531 531 controller='changeset', action='changeset_raw',
532 532 revision='tip', conditions=dict(function=check_repo))
533 533
534 534 rmap.connect('changeset_patch_home',
535 535 '/{repo_name:.*?}/changeset-patch/{revision}',
536 536 controller='changeset', action='changeset_patch',
537 537 revision='tip', conditions=dict(function=check_repo))
538 538
539 539 rmap.connect('changeset_download_home',
540 540 '/{repo_name:.*?}/changeset-download/{revision}',
541 541 controller='changeset', action='changeset_download',
542 542 revision='tip', conditions=dict(function=check_repo))
543 543
544 544 rmap.connect('changeset_comment',
545 545 '/{repo_name:.*?}/changeset/{revision}/comment',
546 546 controller='changeset', revision='tip', action='comment',
547 547 conditions=dict(function=check_repo))
548 548
549 549 rmap.connect('changeset_comment_preview',
550 550 '/{repo_name:.*?}/changeset/comment/preview',
551 551 controller='changeset', action='preview_comment',
552 552 conditions=dict(function=check_repo, method=["POST"]))
553 553
554 554 rmap.connect('changeset_comment_delete',
555 555 '/{repo_name:.*?}/changeset/comment/{comment_id}/delete',
556 556 controller='changeset', action='delete_comment',
557 557 conditions=dict(function=check_repo, method=["DELETE"]))
558 558
559 559 rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}',
560 560 controller='changeset', action='changeset_info')
561 561
562 562 rmap.connect('compare_url',
563 563 '/{repo_name:.*?}/compare/{org_ref_type}@{org_ref:.*?}...{other_ref_type}@{other_ref:.*?}',
564 564 controller='compare', action='index',
565 565 conditions=dict(function=check_repo),
566 566 requirements=dict(
567 567 org_ref_type='(branch|book|tag|rev|__other_ref_type__)',
568 568 other_ref_type='(branch|book|tag|rev|__org_ref_type__)')
569 569 )
570 570
571 571 rmap.connect('pullrequest_home',
572 572 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
573 573 action='index', conditions=dict(function=check_repo,
574 574 method=["GET"]))
575 575
576 576 rmap.connect('pullrequest',
577 577 '/{repo_name:.*?}/pull-request/new', controller='pullrequests',
578 578 action='create', conditions=dict(function=check_repo,
579 579 method=["POST"]))
580 580
581 581 rmap.connect('pullrequest_show',
582 582 '/{repo_name:.*?}/pull-request/{pull_request_id}',
583 583 controller='pullrequests',
584 584 action='show', conditions=dict(function=check_repo,
585 585 method=["GET"]))
586 586 rmap.connect('pullrequest_update',
587 587 '/{repo_name:.*?}/pull-request/{pull_request_id}',
588 588 controller='pullrequests',
589 589 action='update', conditions=dict(function=check_repo,
590 590 method=["PUT"]))
591 591 rmap.connect('pullrequest_delete',
592 592 '/{repo_name:.*?}/pull-request/{pull_request_id}',
593 593 controller='pullrequests',
594 594 action='delete', conditions=dict(function=check_repo,
595 595 method=["DELETE"]))
596 596
597 597 rmap.connect('pullrequest_show_all',
598 598 '/{repo_name:.*?}/pull-request',
599 599 controller='pullrequests',
600 600 action='show_all', conditions=dict(function=check_repo,
601 601 method=["GET"]))
602 602
603 603 rmap.connect('pullrequest_comment',
604 604 '/{repo_name:.*?}/pull-request-comment/{pull_request_id}',
605 605 controller='pullrequests',
606 606 action='comment', conditions=dict(function=check_repo,
607 607 method=["POST"]))
608 608
609 609 rmap.connect('pullrequest_comment_delete',
610 610 '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete',
611 611 controller='pullrequests', action='delete_comment',
612 612 conditions=dict(function=check_repo, method=["DELETE"]))
613 613
614 614 rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary',
615 615 controller='summary', conditions=dict(function=check_repo))
616 616
617 617 rmap.connect('branches_home', '/{repo_name:.*?}/branches',
618 618 controller='branches', conditions=dict(function=check_repo))
619 619
620 620 rmap.connect('tags_home', '/{repo_name:.*?}/tags',
621 621 controller='tags', conditions=dict(function=check_repo))
622 622
623 623 rmap.connect('bookmarks_home', '/{repo_name:.*?}/bookmarks',
624 624 controller='bookmarks', conditions=dict(function=check_repo))
625 625
626 626 rmap.connect('changelog_home', '/{repo_name:.*?}/changelog',
627 627 controller='changelog', conditions=dict(function=check_repo))
628 628
629 629 rmap.connect('changelog_summary_home', '/{repo_name:.*?}/changelog_summary',
630 630 controller='changelog', action='changelog_summary',
631 631 conditions=dict(function=check_repo))
632 632
633 633 rmap.connect('changelog_file_home', '/{repo_name:.*?}/changelog/{revision}/{f_path:.*}',
634 634 controller='changelog', f_path=None,
635 635 conditions=dict(function=check_repo))
636 636
637 637 rmap.connect('changelog_details', '/{repo_name:.*?}/changelog_details/{cs}',
638 638 controller='changelog', action='changelog_details',
639 639 conditions=dict(function=check_repo))
640 640
641 641 rmap.connect('files_home', '/{repo_name:.*?}/files/{revision}/{f_path:.*}',
642 642 controller='files', revision='tip', f_path='',
643 643 conditions=dict(function=check_repo))
644 644
645 645 rmap.connect('files_home_nopath', '/{repo_name:.*?}/files/{revision}',
646 646 controller='files', revision='tip', f_path='',
647 647 conditions=dict(function=check_repo))
648 648
649 649 rmap.connect('files_history_home',
650 650 '/{repo_name:.*?}/history/{revision}/{f_path:.*}',
651 651 controller='files', action='history', revision='tip', f_path='',
652 652 conditions=dict(function=check_repo))
653 653
654 654 rmap.connect('files_diff_home', '/{repo_name:.*?}/diff/{f_path:.*}',
655 655 controller='files', action='diff', revision='tip', f_path='',
656 656 conditions=dict(function=check_repo))
657 657
658 658 rmap.connect('files_rawfile_home',
659 659 '/{repo_name:.*?}/rawfile/{revision}/{f_path:.*}',
660 660 controller='files', action='rawfile', revision='tip',
661 661 f_path='', conditions=dict(function=check_repo))
662 662
663 663 rmap.connect('files_raw_home',
664 664 '/{repo_name:.*?}/raw/{revision}/{f_path:.*}',
665 665 controller='files', action='raw', revision='tip', f_path='',
666 666 conditions=dict(function=check_repo))
667 667
668 668 rmap.connect('files_annotate_home',
669 669 '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}',
670 670 controller='files', action='index', revision='tip',
671 671 f_path='', annotate=True, conditions=dict(function=check_repo))
672 672
673 673 rmap.connect('files_edit_home',
674 674 '/{repo_name:.*?}/edit/{revision}/{f_path:.*}',
675 675 controller='files', action='edit', revision='tip',
676 676 f_path='', conditions=dict(function=check_repo))
677 677
678 678 rmap.connect('files_add_home',
679 679 '/{repo_name:.*?}/add/{revision}/{f_path:.*}',
680 680 controller='files', action='add', revision='tip',
681 681 f_path='', conditions=dict(function=check_repo))
682 682
683 683 rmap.connect('files_archive_home', '/{repo_name:.*?}/archive/{fname}',
684 684 controller='files', action='archivefile',
685 685 conditions=dict(function=check_repo))
686 686
687 687 rmap.connect('files_nodelist_home',
688 688 '/{repo_name:.*?}/nodelist/{revision}/{f_path:.*}',
689 689 controller='files', action='nodelist',
690 690 conditions=dict(function=check_repo))
691 691
692 692 rmap.connect('repo_fork_create_home', '/{repo_name:.*?}/fork',
693 693 controller='forks', action='fork_create',
694 694 conditions=dict(function=check_repo, method=["POST"]))
695 695
696 696 rmap.connect('repo_fork_home', '/{repo_name:.*?}/fork',
697 697 controller='forks', action='fork',
698 698 conditions=dict(function=check_repo))
699 699
700 700 rmap.connect('repo_forks_home', '/{repo_name:.*?}/forks',
701 701 controller='forks', action='forks',
702 702 conditions=dict(function=check_repo))
703 703
704 704 rmap.connect('repo_followers_home', '/{repo_name:.*?}/followers',
705 705 controller='followers', action='followers',
706 706 conditions=dict(function=check_repo))
707 707
708 708 return rmap
General Comments 0
You need to be logged in to leave comments. Login now