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