Mercurial > kallithea
comparison pylons_app/config/routing.py @ 371:5cd6616b8673
routes python 2.5 compatible
added my account settings,
some changes to routes mappers for settings to more custom ones
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 28 Jul 2010 01:44:39 +0200 |
parents | 98abf8953b87 |
children | ca54622e39a1 |
comparison
equal
deleted
inserted
replaced
370:5df93e22eec0 | 371:5cd6616b8673 |
---|---|
2 | 2 |
3 The more specific and detailed routes should be defined first so they | 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 | 4 may take precedent over the more generic routes. For more information |
5 refer to the routes manual at http://routes.groovie.org/docs/ | 5 refer to the routes manual at http://routes.groovie.org/docs/ |
6 """ | 6 """ |
7 from __future__ import with_statement | |
7 from routes import Mapper | 8 from routes import Mapper |
8 from pylons_app.lib.utils import check_repo_fast as cr | 9 from pylons_app.lib.utils import check_repo_fast as cr |
9 | 10 |
10 def make_map(config): | 11 def make_map(config): |
11 """Create, configure and return the routes Mapper""" | 12 """Create, configure and return the routes Mapper""" |
29 @param match_dict: | 30 @param match_dict: |
30 """ | 31 """ |
31 repo_name = match_dict.get('repo_name') | 32 repo_name = match_dict.get('repo_name') |
32 return not cr(repo_name, config['base_path']) | 33 return not cr(repo_name, config['base_path']) |
33 | 34 |
34 #REST routes | 35 #REST REPO MAP |
35 with map.submapper(path_prefix='/_admin', controller='admin/repos') as m: | 36 with map.submapper(path_prefix='/_admin', controller='admin/repos') as m: |
36 m.connect("repos", "/repos", | 37 m.connect("repos", "/repos", |
37 action="create", conditions=dict(method=["POST"])) | 38 action="create", conditions=dict(method=["POST"])) |
38 m.connect("repos", "/repos", | 39 m.connect("repos", "/repos", |
39 action="index", conditions=dict(method=["GET"])) | 40 action="index", conditions=dict(method=["GET"])) |
67 action="delete_perm_user", conditions=dict(method=["DELETE"], | 68 action="delete_perm_user", conditions=dict(method=["DELETE"], |
68 function=check_repo)) | 69 function=check_repo)) |
69 | 70 |
70 map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') | 71 map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') |
71 map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') | 72 map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') |
72 map.resource('setting', 'settings', controller='admin/settings', path_prefix='/_admin', name_prefix='admin_') | 73 |
74 #map.resource('setting', 'settings', controller='admin/settings', path_prefix='/_admin', name_prefix='admin_') | |
75 #REST SETTINGS MAP | |
76 with map.submapper(path_prefix='/_admin', controller='admin/settings') as m: | |
77 m.connect("admin_settings", "/settings", | |
78 action="create", conditions=dict(method=["POST"])) | |
79 m.connect("admin_settings", "/settings", | |
80 action="index", conditions=dict(method=["GET"])) | |
81 m.connect("admin_formatted_settings", "/settings.{format}", | |
82 action="index", conditions=dict(method=["GET"])) | |
83 m.connect("admin_new_setting", "/settings/new", | |
84 action="new", conditions=dict(method=["GET"])) | |
85 m.connect("admin_formatted_new_setting", "/settings/new.{format}", | |
86 action="new", conditions=dict(method=["GET"])) | |
87 m.connect("/settings/{setting_id}", | |
88 action="update", conditions=dict(method=["PUT"])) | |
89 m.connect("/settings/{setting_id}", | |
90 action="delete", conditions=dict(method=["DELETE"])) | |
91 m.connect("admin_edit_setting", "/settings/{setting_id}/edit", | |
92 action="edit", conditions=dict(method=["GET"])) | |
93 m.connect("admin_formatted_edit_setting", "/settings/{setting_id}.{format}/edit", | |
94 action="edit", conditions=dict(method=["GET"])) | |
95 m.connect("admin_setting", "/settings/{setting_id}", | |
96 action="show", conditions=dict(method=["GET"])) | |
97 m.connect("admin_formatted_setting", "/settings/{setting_id}.{format}", | |
98 action="show", conditions=dict(method=["GET"])) | |
99 m.connect("admin_settings_my_account", "/my_account", | |
100 action="my_account", conditions=dict(method=["GET"])) | |
101 m.connect("admin_settings_my_account_update", "/my_account_update", | |
102 action="my_account_update", conditions=dict(method=["PUT"])) | |
73 | 103 |
74 #ADMIN | 104 #ADMIN |
75 with map.submapper(path_prefix='/_admin', controller='admin/admin') as m: | 105 with map.submapper(path_prefix='/_admin', controller='admin/admin') as m: |
76 m.connect('admin_home', '', action='index')#main page | 106 m.connect('admin_home', '', action='index')#main page |
77 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | 107 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |