Show More
@@ -1,1106 +1,1085 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2016 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2016 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
22 | Routes configuration |
|
22 | Routes configuration | |
23 |
|
23 | |||
24 | The more specific and detailed routes should be defined first so they |
|
24 | The more specific and detailed routes should be defined first so they | |
25 | may take precedent over the more generic routes. For more information |
|
25 | may take precedent over the more generic routes. For more information | |
26 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
26 | refer to the routes manual at http://routes.groovie.org/docs/ | |
27 |
|
27 | |||
28 | IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py |
|
28 | IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py | |
29 | and _route_name variable which uses some of stored naming here to do redirects. |
|
29 | and _route_name variable which uses some of stored naming here to do redirects. | |
30 | """ |
|
30 | """ | |
31 | import os |
|
31 | import os | |
32 | from routes import Mapper |
|
32 | from routes import Mapper | |
33 |
|
33 | |||
34 | from rhodecode.config import routing_links |
|
34 | from rhodecode.config import routing_links | |
35 |
|
35 | |||
36 | # prefix for non repository related links needs to be prefixed with `/` |
|
36 | # prefix for non repository related links needs to be prefixed with `/` | |
37 | ADMIN_PREFIX = '/_admin' |
|
37 | ADMIN_PREFIX = '/_admin' | |
38 |
|
38 | |||
39 | # Default requirements for URL parts |
|
39 | # Default requirements for URL parts | |
40 | URL_NAME_REQUIREMENTS = { |
|
40 | URL_NAME_REQUIREMENTS = { | |
41 | # group name can have a slash in them, but they must not end with a slash |
|
41 | # group name can have a slash in them, but they must not end with a slash | |
42 | 'group_name': r'.*?[^/]', |
|
42 | 'group_name': r'.*?[^/]', | |
43 | # repo names can have a slash in them, but they must not end with a slash |
|
43 | # repo names can have a slash in them, but they must not end with a slash | |
44 | 'repo_name': r'.*?[^/]', |
|
44 | 'repo_name': r'.*?[^/]', | |
45 | # file path eats up everything at the end |
|
45 | # file path eats up everything at the end | |
46 | 'f_path': r'.*', |
|
46 | 'f_path': r'.*', | |
47 | # reference types |
|
47 | # reference types | |
48 | 'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)', |
|
48 | 'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)', | |
49 | 'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)', |
|
49 | 'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)', | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 |
|
52 | |||
53 | def make_map(config): |
|
53 | def make_map(config): | |
54 | """Create, configure and return the routes Mapper""" |
|
54 | """Create, configure and return the routes Mapper""" | |
55 | rmap = Mapper(directory=config['pylons.paths']['controllers'], |
|
55 | rmap = Mapper(directory=config['pylons.paths']['controllers'], | |
56 | always_scan=config['debug']) |
|
56 | always_scan=config['debug']) | |
57 | rmap.minimization = False |
|
57 | rmap.minimization = False | |
58 | rmap.explicit = False |
|
58 | rmap.explicit = False | |
59 |
|
59 | |||
60 | from rhodecode.lib.utils2 import str2bool |
|
60 | from rhodecode.lib.utils2 import str2bool | |
61 | from rhodecode.model import repo, repo_group |
|
61 | from rhodecode.model import repo, repo_group | |
62 |
|
62 | |||
63 | def check_repo(environ, match_dict): |
|
63 | def check_repo(environ, match_dict): | |
64 | """ |
|
64 | """ | |
65 | check for valid repository for proper 404 handling |
|
65 | check for valid repository for proper 404 handling | |
66 |
|
66 | |||
67 | :param environ: |
|
67 | :param environ: | |
68 | :param match_dict: |
|
68 | :param match_dict: | |
69 | """ |
|
69 | """ | |
70 | repo_name = match_dict.get('repo_name') |
|
70 | repo_name = match_dict.get('repo_name') | |
71 |
|
71 | |||
72 | if match_dict.get('f_path'): |
|
72 | if match_dict.get('f_path'): | |
73 | # fix for multiple initial slashes that causes errors |
|
73 | # fix for multiple initial slashes that causes errors | |
74 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') |
|
74 | match_dict['f_path'] = match_dict['f_path'].lstrip('/') | |
75 | repo_model = repo.RepoModel() |
|
75 | repo_model = repo.RepoModel() | |
76 | by_name_match = repo_model.get_by_repo_name(repo_name) |
|
76 | by_name_match = repo_model.get_by_repo_name(repo_name) | |
77 | # if we match quickly from database, short circuit the operation, |
|
77 | # if we match quickly from database, short circuit the operation, | |
78 | # and validate repo based on the type. |
|
78 | # and validate repo based on the type. | |
79 | if by_name_match: |
|
79 | if by_name_match: | |
80 | return True |
|
80 | return True | |
81 |
|
81 | |||
82 | by_id_match = repo_model.get_repo_by_id(repo_name) |
|
82 | by_id_match = repo_model.get_repo_by_id(repo_name) | |
83 | if by_id_match: |
|
83 | if by_id_match: | |
84 | repo_name = by_id_match.repo_name |
|
84 | repo_name = by_id_match.repo_name | |
85 | match_dict['repo_name'] = repo_name |
|
85 | match_dict['repo_name'] = repo_name | |
86 | return True |
|
86 | return True | |
87 |
|
87 | |||
88 | return False |
|
88 | return False | |
89 |
|
89 | |||
90 | def check_group(environ, match_dict): |
|
90 | def check_group(environ, match_dict): | |
91 | """ |
|
91 | """ | |
92 | check for valid repository group path for proper 404 handling |
|
92 | check for valid repository group path for proper 404 handling | |
93 |
|
93 | |||
94 | :param environ: |
|
94 | :param environ: | |
95 | :param match_dict: |
|
95 | :param match_dict: | |
96 | """ |
|
96 | """ | |
97 | repo_group_name = match_dict.get('group_name') |
|
97 | repo_group_name = match_dict.get('group_name') | |
98 | repo_group_model = repo_group.RepoGroupModel() |
|
98 | repo_group_model = repo_group.RepoGroupModel() | |
99 | by_name_match = repo_group_model.get_by_group_name(repo_group_name) |
|
99 | by_name_match = repo_group_model.get_by_group_name(repo_group_name) | |
100 | if by_name_match: |
|
100 | if by_name_match: | |
101 | return True |
|
101 | return True | |
102 |
|
102 | |||
103 | return False |
|
103 | return False | |
104 |
|
104 | |||
105 | def check_user_group(environ, match_dict): |
|
105 | def check_user_group(environ, match_dict): | |
106 | """ |
|
106 | """ | |
107 | check for valid user group for proper 404 handling |
|
107 | check for valid user group for proper 404 handling | |
108 |
|
108 | |||
109 | :param environ: |
|
109 | :param environ: | |
110 | :param match_dict: |
|
110 | :param match_dict: | |
111 | """ |
|
111 | """ | |
112 | return True |
|
112 | return True | |
113 |
|
113 | |||
114 | def check_int(environ, match_dict): |
|
114 | def check_int(environ, match_dict): | |
115 | return match_dict.get('id').isdigit() |
|
115 | return match_dict.get('id').isdigit() | |
116 |
|
116 | |||
117 | # The ErrorController route (handles 404/500 error pages); it should |
|
117 | # The ErrorController route (handles 404/500 error pages); it should | |
118 | # likely stay at the top, ensuring it can always be resolved |
|
118 | # likely stay at the top, ensuring it can always be resolved | |
119 | rmap.connect('/error/{action}', controller='error') |
|
119 | rmap.connect('/error/{action}', controller='error') | |
120 | rmap.connect('/error/{action}/{id}', controller='error') |
|
120 | rmap.connect('/error/{action}/{id}', controller='error') | |
121 |
|
121 | |||
122 | #========================================================================== |
|
122 | #========================================================================== | |
123 | # CUSTOM ROUTES HERE |
|
123 | # CUSTOM ROUTES HERE | |
124 | #========================================================================== |
|
124 | #========================================================================== | |
125 |
|
125 | |||
126 | # MAIN PAGE |
|
126 | # MAIN PAGE | |
127 | rmap.connect('home', '/', controller='home', action='index') |
|
127 | rmap.connect('home', '/', controller='home', action='index') | |
128 | rmap.connect('repo_switcher_data', '/_repos_and_groups', controller='home', |
|
128 | rmap.connect('repo_switcher_data', '/_repos_and_groups', controller='home', | |
129 | action='repo_switcher_data') |
|
129 | action='repo_switcher_data') | |
130 | rmap.connect('repo_list_data', '/_repos', controller='home', |
|
130 | rmap.connect('repo_list_data', '/_repos', controller='home', | |
131 | action='repo_list_data') |
|
131 | action='repo_list_data') | |
132 |
|
132 | |||
133 | rmap.connect('user_autocomplete_data', '/_users', controller='home', |
|
133 | rmap.connect('user_autocomplete_data', '/_users', controller='home', | |
134 | action='user_autocomplete_data') |
|
134 | action='user_autocomplete_data') | |
135 | rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home', |
|
135 | rmap.connect('user_group_autocomplete_data', '/_user_groups', controller='home', | |
136 | action='user_group_autocomplete_data') |
|
136 | action='user_group_autocomplete_data') | |
137 |
|
137 | |||
138 | rmap.connect( |
|
138 | rmap.connect( | |
139 | 'user_profile', '/_profiles/{username}', controller='users', |
|
139 | 'user_profile', '/_profiles/{username}', controller='users', | |
140 | action='user_profile') |
|
140 | action='user_profile') | |
141 |
|
141 | |||
142 | # TODO: johbo: Static links, to be replaced by our redirection mechanism |
|
142 | # TODO: johbo: Static links, to be replaced by our redirection mechanism | |
143 | rmap.connect('rst_help', |
|
143 | rmap.connect('rst_help', | |
144 | 'http://docutils.sourceforge.net/docs/user/rst/quickref.html', |
|
144 | 'http://docutils.sourceforge.net/docs/user/rst/quickref.html', | |
145 | _static=True) |
|
145 | _static=True) | |
146 | rmap.connect('markdown_help', |
|
146 | rmap.connect('markdown_help', | |
147 | 'http://daringfireball.net/projects/markdown/syntax', |
|
147 | 'http://daringfireball.net/projects/markdown/syntax', | |
148 | _static=True) |
|
148 | _static=True) | |
149 | rmap.connect('rhodecode_official', 'https://rhodecode.com', _static=True) |
|
149 | rmap.connect('rhodecode_official', 'https://rhodecode.com', _static=True) | |
150 | rmap.connect('rhodecode_support', 'https://rhodecode.com/help/', _static=True) |
|
150 | rmap.connect('rhodecode_support', 'https://rhodecode.com/help/', _static=True) | |
151 | rmap.connect('rhodecode_translations', 'https://rhodecode.com/translate/enterprise', _static=True) |
|
151 | rmap.connect('rhodecode_translations', 'https://rhodecode.com/translate/enterprise', _static=True) | |
152 | # TODO: anderson - making this a static link since redirect won't play |
|
152 | # TODO: anderson - making this a static link since redirect won't play | |
153 | # nice with POST requests |
|
153 | # nice with POST requests | |
154 | rmap.connect('enterprise_license_convert_from_old', |
|
154 | rmap.connect('enterprise_license_convert_from_old', | |
155 | 'https://rhodecode.com/u/license-upgrade', |
|
155 | 'https://rhodecode.com/u/license-upgrade', | |
156 | _static=True) |
|
156 | _static=True) | |
157 |
|
157 | |||
158 | routing_links.connect_redirection_links(rmap) |
|
158 | routing_links.connect_redirection_links(rmap) | |
159 |
|
159 | |||
160 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') |
|
160 | rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping') | |
161 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') |
|
161 | rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test') | |
162 |
|
162 | |||
163 | # ADMIN REPOSITORY ROUTES |
|
163 | # ADMIN REPOSITORY ROUTES | |
164 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
164 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
165 | controller='admin/repos') as m: |
|
165 | controller='admin/repos') as m: | |
166 | m.connect('repos', '/repos', |
|
166 | m.connect('repos', '/repos', | |
167 | action='create', conditions={'method': ['POST']}) |
|
167 | action='create', conditions={'method': ['POST']}) | |
168 | m.connect('repos', '/repos', |
|
168 | m.connect('repos', '/repos', | |
169 | action='index', conditions={'method': ['GET']}) |
|
169 | action='index', conditions={'method': ['GET']}) | |
170 | m.connect('new_repo', '/create_repository', |
|
170 | m.connect('new_repo', '/create_repository', | |
171 | action='create_repository', conditions={'method': ['GET']}) |
|
171 | action='create_repository', conditions={'method': ['GET']}) | |
172 | m.connect('/repos/{repo_name}', |
|
172 | m.connect('/repos/{repo_name}', | |
173 | action='update', conditions={'method': ['PUT'], |
|
173 | action='update', conditions={'method': ['PUT'], | |
174 | 'function': check_repo}, |
|
174 | 'function': check_repo}, | |
175 | requirements=URL_NAME_REQUIREMENTS) |
|
175 | requirements=URL_NAME_REQUIREMENTS) | |
176 | m.connect('delete_repo', '/repos/{repo_name}', |
|
176 | m.connect('delete_repo', '/repos/{repo_name}', | |
177 | action='delete', conditions={'method': ['DELETE']}, |
|
177 | action='delete', conditions={'method': ['DELETE']}, | |
178 | requirements=URL_NAME_REQUIREMENTS) |
|
178 | requirements=URL_NAME_REQUIREMENTS) | |
179 | m.connect('repo', '/repos/{repo_name}', |
|
179 | m.connect('repo', '/repos/{repo_name}', | |
180 | action='show', conditions={'method': ['GET'], |
|
180 | action='show', conditions={'method': ['GET'], | |
181 | 'function': check_repo}, |
|
181 | 'function': check_repo}, | |
182 | requirements=URL_NAME_REQUIREMENTS) |
|
182 | requirements=URL_NAME_REQUIREMENTS) | |
183 |
|
183 | |||
184 | # ADMIN REPOSITORY GROUPS ROUTES |
|
184 | # ADMIN REPOSITORY GROUPS ROUTES | |
185 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
185 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
186 | controller='admin/repo_groups') as m: |
|
186 | controller='admin/repo_groups') as m: | |
187 | m.connect('repo_groups', '/repo_groups', |
|
187 | m.connect('repo_groups', '/repo_groups', | |
188 | action='create', conditions={'method': ['POST']}) |
|
188 | action='create', conditions={'method': ['POST']}) | |
189 | m.connect('repo_groups', '/repo_groups', |
|
189 | m.connect('repo_groups', '/repo_groups', | |
190 | action='index', conditions={'method': ['GET']}) |
|
190 | action='index', conditions={'method': ['GET']}) | |
191 | m.connect('new_repo_group', '/repo_groups/new', |
|
191 | m.connect('new_repo_group', '/repo_groups/new', | |
192 | action='new', conditions={'method': ['GET']}) |
|
192 | action='new', conditions={'method': ['GET']}) | |
193 | m.connect('update_repo_group', '/repo_groups/{group_name}', |
|
193 | m.connect('update_repo_group', '/repo_groups/{group_name}', | |
194 | action='update', conditions={'method': ['PUT'], |
|
194 | action='update', conditions={'method': ['PUT'], | |
195 | 'function': check_group}, |
|
195 | 'function': check_group}, | |
196 | requirements=URL_NAME_REQUIREMENTS) |
|
196 | requirements=URL_NAME_REQUIREMENTS) | |
197 |
|
197 | |||
198 | # EXTRAS REPO GROUP ROUTES |
|
198 | # EXTRAS REPO GROUP ROUTES | |
199 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
199 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', | |
200 | action='edit', |
|
200 | action='edit', | |
201 | conditions={'method': ['GET'], 'function': check_group}, |
|
201 | conditions={'method': ['GET'], 'function': check_group}, | |
202 | requirements=URL_NAME_REQUIREMENTS) |
|
202 | requirements=URL_NAME_REQUIREMENTS) | |
203 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', |
|
203 | m.connect('edit_repo_group', '/repo_groups/{group_name}/edit', | |
204 | action='edit', |
|
204 | action='edit', | |
205 | conditions={'method': ['PUT'], 'function': check_group}, |
|
205 | conditions={'method': ['PUT'], 'function': check_group}, | |
206 | requirements=URL_NAME_REQUIREMENTS) |
|
206 | requirements=URL_NAME_REQUIREMENTS) | |
207 |
|
207 | |||
208 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
208 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', | |
209 | action='edit_repo_group_advanced', |
|
209 | action='edit_repo_group_advanced', | |
210 | conditions={'method': ['GET'], 'function': check_group}, |
|
210 | conditions={'method': ['GET'], 'function': check_group}, | |
211 | requirements=URL_NAME_REQUIREMENTS) |
|
211 | requirements=URL_NAME_REQUIREMENTS) | |
212 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', |
|
212 | m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced', | |
213 | action='edit_repo_group_advanced', |
|
213 | action='edit_repo_group_advanced', | |
214 | conditions={'method': ['PUT'], 'function': check_group}, |
|
214 | conditions={'method': ['PUT'], 'function': check_group}, | |
215 | requirements=URL_NAME_REQUIREMENTS) |
|
215 | requirements=URL_NAME_REQUIREMENTS) | |
216 |
|
216 | |||
217 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
217 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', | |
218 | action='edit_repo_group_perms', |
|
218 | action='edit_repo_group_perms', | |
219 | conditions={'method': ['GET'], 'function': check_group}, |
|
219 | conditions={'method': ['GET'], 'function': check_group}, | |
220 | requirements=URL_NAME_REQUIREMENTS) |
|
220 | requirements=URL_NAME_REQUIREMENTS) | |
221 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', |
|
221 | m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions', | |
222 | action='update_perms', |
|
222 | action='update_perms', | |
223 | conditions={'method': ['PUT'], 'function': check_group}, |
|
223 | conditions={'method': ['PUT'], 'function': check_group}, | |
224 | requirements=URL_NAME_REQUIREMENTS) |
|
224 | requirements=URL_NAME_REQUIREMENTS) | |
225 |
|
225 | |||
226 | m.connect('delete_repo_group', '/repo_groups/{group_name}', |
|
226 | m.connect('delete_repo_group', '/repo_groups/{group_name}', | |
227 | action='delete', conditions={'method': ['DELETE'], |
|
227 | action='delete', conditions={'method': ['DELETE'], | |
228 | 'function': check_group}, |
|
228 | 'function': check_group}, | |
229 | requirements=URL_NAME_REQUIREMENTS) |
|
229 | requirements=URL_NAME_REQUIREMENTS) | |
230 |
|
230 | |||
231 | # ADMIN USER ROUTES |
|
231 | # ADMIN USER ROUTES | |
232 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
232 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
233 | controller='admin/users') as m: |
|
233 | controller='admin/users') as m: | |
234 | m.connect('users', '/users', |
|
234 | m.connect('users', '/users', | |
235 | action='create', conditions={'method': ['POST']}) |
|
235 | action='create', conditions={'method': ['POST']}) | |
236 | m.connect('users', '/users', |
|
236 | m.connect('users', '/users', | |
237 | action='index', conditions={'method': ['GET']}) |
|
237 | action='index', conditions={'method': ['GET']}) | |
238 | m.connect('new_user', '/users/new', |
|
238 | m.connect('new_user', '/users/new', | |
239 | action='new', conditions={'method': ['GET']}) |
|
239 | action='new', conditions={'method': ['GET']}) | |
240 | m.connect('update_user', '/users/{user_id}', |
|
240 | m.connect('update_user', '/users/{user_id}', | |
241 | action='update', conditions={'method': ['PUT']}) |
|
241 | action='update', conditions={'method': ['PUT']}) | |
242 | m.connect('delete_user', '/users/{user_id}', |
|
242 | m.connect('delete_user', '/users/{user_id}', | |
243 | action='delete', conditions={'method': ['DELETE']}) |
|
243 | action='delete', conditions={'method': ['DELETE']}) | |
244 | m.connect('edit_user', '/users/{user_id}/edit', |
|
244 | m.connect('edit_user', '/users/{user_id}/edit', | |
245 | action='edit', conditions={'method': ['GET']}) |
|
245 | action='edit', conditions={'method': ['GET']}) | |
246 | m.connect('user', '/users/{user_id}', |
|
246 | m.connect('user', '/users/{user_id}', | |
247 | action='show', conditions={'method': ['GET']}) |
|
247 | action='show', conditions={'method': ['GET']}) | |
248 | m.connect('force_password_reset_user', '/users/{user_id}/password_reset', |
|
248 | m.connect('force_password_reset_user', '/users/{user_id}/password_reset', | |
249 | action='reset_password', conditions={'method': ['POST']}) |
|
249 | action='reset_password', conditions={'method': ['POST']}) | |
250 | m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group', |
|
250 | m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group', | |
251 | action='create_personal_repo_group', conditions={'method': ['POST']}) |
|
251 | action='create_personal_repo_group', conditions={'method': ['POST']}) | |
252 |
|
252 | |||
253 | # EXTRAS USER ROUTES |
|
253 | # EXTRAS USER ROUTES | |
254 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
254 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', | |
255 | action='edit_advanced', conditions={'method': ['GET']}) |
|
255 | action='edit_advanced', conditions={'method': ['GET']}) | |
256 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', |
|
256 | m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced', | |
257 | action='update_advanced', conditions={'method': ['PUT']}) |
|
257 | action='update_advanced', conditions={'method': ['PUT']}) | |
258 |
|
258 | |||
259 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
259 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', | |
260 | action='edit_auth_tokens', conditions={'method': ['GET']}) |
|
260 | action='edit_auth_tokens', conditions={'method': ['GET']}) | |
261 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
261 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', | |
262 | action='add_auth_token', conditions={'method': ['PUT']}) |
|
262 | action='add_auth_token', conditions={'method': ['PUT']}) | |
263 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', |
|
263 | m.connect('edit_user_auth_tokens', '/users/{user_id}/edit/auth_tokens', | |
264 | action='delete_auth_token', conditions={'method': ['DELETE']}) |
|
264 | action='delete_auth_token', conditions={'method': ['DELETE']}) | |
265 |
|
265 | |||
266 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
266 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', | |
267 | action='edit_global_perms', conditions={'method': ['GET']}) |
|
267 | action='edit_global_perms', conditions={'method': ['GET']}) | |
268 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', |
|
268 | m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions', | |
269 | action='update_global_perms', conditions={'method': ['PUT']}) |
|
269 | action='update_global_perms', conditions={'method': ['PUT']}) | |
270 |
|
270 | |||
271 | m.connect('edit_user_perms_summary', '/users/{user_id}/edit/permissions_summary', |
|
271 | m.connect('edit_user_perms_summary', '/users/{user_id}/edit/permissions_summary', | |
272 | action='edit_perms_summary', conditions={'method': ['GET']}) |
|
272 | action='edit_perms_summary', conditions={'method': ['GET']}) | |
273 |
|
273 | |||
274 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
274 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', | |
275 | action='edit_emails', conditions={'method': ['GET']}) |
|
275 | action='edit_emails', conditions={'method': ['GET']}) | |
276 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
276 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', | |
277 | action='add_email', conditions={'method': ['PUT']}) |
|
277 | action='add_email', conditions={'method': ['PUT']}) | |
278 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', |
|
278 | m.connect('edit_user_emails', '/users/{user_id}/edit/emails', | |
279 | action='delete_email', conditions={'method': ['DELETE']}) |
|
279 | action='delete_email', conditions={'method': ['DELETE']}) | |
280 |
|
280 | |||
281 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
281 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', | |
282 | action='edit_ips', conditions={'method': ['GET']}) |
|
282 | action='edit_ips', conditions={'method': ['GET']}) | |
283 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
283 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', | |
284 | action='add_ip', conditions={'method': ['PUT']}) |
|
284 | action='add_ip', conditions={'method': ['PUT']}) | |
285 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', |
|
285 | m.connect('edit_user_ips', '/users/{user_id}/edit/ips', | |
286 | action='delete_ip', conditions={'method': ['DELETE']}) |
|
286 | action='delete_ip', conditions={'method': ['DELETE']}) | |
287 |
|
287 | |||
288 | # ADMIN USER GROUPS REST ROUTES |
|
288 | # ADMIN USER GROUPS REST ROUTES | |
289 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
289 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
290 | controller='admin/user_groups') as m: |
|
290 | controller='admin/user_groups') as m: | |
291 | m.connect('users_groups', '/user_groups', |
|
291 | m.connect('users_groups', '/user_groups', | |
292 | action='create', conditions={'method': ['POST']}) |
|
292 | action='create', conditions={'method': ['POST']}) | |
293 | m.connect('users_groups', '/user_groups', |
|
293 | m.connect('users_groups', '/user_groups', | |
294 | action='index', conditions={'method': ['GET']}) |
|
294 | action='index', conditions={'method': ['GET']}) | |
295 | m.connect('new_users_group', '/user_groups/new', |
|
295 | m.connect('new_users_group', '/user_groups/new', | |
296 | action='new', conditions={'method': ['GET']}) |
|
296 | action='new', conditions={'method': ['GET']}) | |
297 | m.connect('update_users_group', '/user_groups/{user_group_id}', |
|
297 | m.connect('update_users_group', '/user_groups/{user_group_id}', | |
298 | action='update', conditions={'method': ['PUT']}) |
|
298 | action='update', conditions={'method': ['PUT']}) | |
299 | m.connect('delete_users_group', '/user_groups/{user_group_id}', |
|
299 | m.connect('delete_users_group', '/user_groups/{user_group_id}', | |
300 | action='delete', conditions={'method': ['DELETE']}) |
|
300 | action='delete', conditions={'method': ['DELETE']}) | |
301 | m.connect('edit_users_group', '/user_groups/{user_group_id}/edit', |
|
301 | m.connect('edit_users_group', '/user_groups/{user_group_id}/edit', | |
302 | action='edit', conditions={'method': ['GET']}, |
|
302 | action='edit', conditions={'method': ['GET']}, | |
303 | function=check_user_group) |
|
303 | function=check_user_group) | |
304 |
|
304 | |||
305 | # EXTRAS USER GROUP ROUTES |
|
305 | # EXTRAS USER GROUP ROUTES | |
306 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', |
|
306 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', | |
307 | action='edit_global_perms', conditions={'method': ['GET']}) |
|
307 | action='edit_global_perms', conditions={'method': ['GET']}) | |
308 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', |
|
308 | m.connect('edit_user_group_global_perms', '/user_groups/{user_group_id}/edit/global_permissions', | |
309 | action='update_global_perms', conditions={'method': ['PUT']}) |
|
309 | action='update_global_perms', conditions={'method': ['PUT']}) | |
310 | m.connect('edit_user_group_perms_summary', '/user_groups/{user_group_id}/edit/permissions_summary', |
|
310 | m.connect('edit_user_group_perms_summary', '/user_groups/{user_group_id}/edit/permissions_summary', | |
311 | action='edit_perms_summary', conditions={'method': ['GET']}) |
|
311 | action='edit_perms_summary', conditions={'method': ['GET']}) | |
312 |
|
312 | |||
313 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', |
|
313 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', | |
314 | action='edit_perms', conditions={'method': ['GET']}) |
|
314 | action='edit_perms', conditions={'method': ['GET']}) | |
315 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', |
|
315 | m.connect('edit_user_group_perms', '/user_groups/{user_group_id}/edit/permissions', | |
316 | action='update_perms', conditions={'method': ['PUT']}) |
|
316 | action='update_perms', conditions={'method': ['PUT']}) | |
317 |
|
317 | |||
318 | m.connect('edit_user_group_advanced', '/user_groups/{user_group_id}/edit/advanced', |
|
318 | m.connect('edit_user_group_advanced', '/user_groups/{user_group_id}/edit/advanced', | |
319 | action='edit_advanced', conditions={'method': ['GET']}) |
|
319 | action='edit_advanced', conditions={'method': ['GET']}) | |
320 |
|
320 | |||
321 | m.connect('edit_user_group_members', '/user_groups/{user_group_id}/edit/members', |
|
321 | m.connect('edit_user_group_members', '/user_groups/{user_group_id}/edit/members', | |
322 | action='edit_members', conditions={'method': ['GET']}) |
|
322 | action='edit_members', conditions={'method': ['GET']}) | |
323 |
|
323 | |||
324 | # ADMIN PERMISSIONS ROUTES |
|
324 | # ADMIN PERMISSIONS ROUTES | |
325 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
325 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
326 | controller='admin/permissions') as m: |
|
326 | controller='admin/permissions') as m: | |
327 | m.connect('admin_permissions_application', '/permissions/application', |
|
327 | m.connect('admin_permissions_application', '/permissions/application', | |
328 | action='permission_application_update', conditions={'method': ['POST']}) |
|
328 | action='permission_application_update', conditions={'method': ['POST']}) | |
329 | m.connect('admin_permissions_application', '/permissions/application', |
|
329 | m.connect('admin_permissions_application', '/permissions/application', | |
330 | action='permission_application', conditions={'method': ['GET']}) |
|
330 | action='permission_application', conditions={'method': ['GET']}) | |
331 |
|
331 | |||
332 | m.connect('admin_permissions_global', '/permissions/global', |
|
332 | m.connect('admin_permissions_global', '/permissions/global', | |
333 | action='permission_global_update', conditions={'method': ['POST']}) |
|
333 | action='permission_global_update', conditions={'method': ['POST']}) | |
334 | m.connect('admin_permissions_global', '/permissions/global', |
|
334 | m.connect('admin_permissions_global', '/permissions/global', | |
335 | action='permission_global', conditions={'method': ['GET']}) |
|
335 | action='permission_global', conditions={'method': ['GET']}) | |
336 |
|
336 | |||
337 | m.connect('admin_permissions_object', '/permissions/object', |
|
337 | m.connect('admin_permissions_object', '/permissions/object', | |
338 | action='permission_objects_update', conditions={'method': ['POST']}) |
|
338 | action='permission_objects_update', conditions={'method': ['POST']}) | |
339 | m.connect('admin_permissions_object', '/permissions/object', |
|
339 | m.connect('admin_permissions_object', '/permissions/object', | |
340 | action='permission_objects', conditions={'method': ['GET']}) |
|
340 | action='permission_objects', conditions={'method': ['GET']}) | |
341 |
|
341 | |||
342 | m.connect('admin_permissions_ips', '/permissions/ips', |
|
342 | m.connect('admin_permissions_ips', '/permissions/ips', | |
343 | action='permission_ips', conditions={'method': ['POST']}) |
|
343 | action='permission_ips', conditions={'method': ['POST']}) | |
344 | m.connect('admin_permissions_ips', '/permissions/ips', |
|
344 | m.connect('admin_permissions_ips', '/permissions/ips', | |
345 | action='permission_ips', conditions={'method': ['GET']}) |
|
345 | action='permission_ips', conditions={'method': ['GET']}) | |
346 |
|
346 | |||
347 | m.connect('admin_permissions_overview', '/permissions/overview', |
|
347 | m.connect('admin_permissions_overview', '/permissions/overview', | |
348 | action='permission_perms', conditions={'method': ['GET']}) |
|
348 | action='permission_perms', conditions={'method': ['GET']}) | |
349 |
|
349 | |||
350 | # ADMIN DEFAULTS REST ROUTES |
|
350 | # ADMIN DEFAULTS REST ROUTES | |
351 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
351 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
352 | controller='admin/defaults') as m: |
|
352 | controller='admin/defaults') as m: | |
353 | m.connect('admin_defaults_repositories', '/defaults/repositories', |
|
353 | m.connect('admin_defaults_repositories', '/defaults/repositories', | |
354 | action='update_repository_defaults', conditions={'method': ['POST']}) |
|
354 | action='update_repository_defaults', conditions={'method': ['POST']}) | |
355 | m.connect('admin_defaults_repositories', '/defaults/repositories', |
|
355 | m.connect('admin_defaults_repositories', '/defaults/repositories', | |
356 | action='index', conditions={'method': ['GET']}) |
|
356 | action='index', conditions={'method': ['GET']}) | |
357 |
|
357 | |||
358 | # ADMIN DEBUG STYLE ROUTES |
|
358 | # ADMIN DEBUG STYLE ROUTES | |
359 | if str2bool(config.get('debug_style')): |
|
359 | if str2bool(config.get('debug_style')): | |
360 | with rmap.submapper(path_prefix=ADMIN_PREFIX + '/debug_style', |
|
360 | with rmap.submapper(path_prefix=ADMIN_PREFIX + '/debug_style', | |
361 | controller='debug_style') as m: |
|
361 | controller='debug_style') as m: | |
362 | m.connect('debug_style_home', '', |
|
362 | m.connect('debug_style_home', '', | |
363 | action='index', conditions={'method': ['GET']}) |
|
363 | action='index', conditions={'method': ['GET']}) | |
364 | m.connect('debug_style_template', '/t/{t_path}', |
|
364 | m.connect('debug_style_template', '/t/{t_path}', | |
365 | action='template', conditions={'method': ['GET']}) |
|
365 | action='template', conditions={'method': ['GET']}) | |
366 |
|
366 | |||
367 | # ADMIN SETTINGS ROUTES |
|
367 | # ADMIN SETTINGS ROUTES | |
368 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
368 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
369 | controller='admin/settings') as m: |
|
369 | controller='admin/settings') as m: | |
370 |
|
370 | |||
371 | # default |
|
371 | # default | |
372 | m.connect('admin_settings', '/settings', |
|
372 | m.connect('admin_settings', '/settings', | |
373 | action='settings_global_update', |
|
373 | action='settings_global_update', | |
374 | conditions={'method': ['POST']}) |
|
374 | conditions={'method': ['POST']}) | |
375 | m.connect('admin_settings', '/settings', |
|
375 | m.connect('admin_settings', '/settings', | |
376 | action='settings_global', conditions={'method': ['GET']}) |
|
376 | action='settings_global', conditions={'method': ['GET']}) | |
377 |
|
377 | |||
378 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
378 | m.connect('admin_settings_vcs', '/settings/vcs', | |
379 | action='settings_vcs_update', |
|
379 | action='settings_vcs_update', | |
380 | conditions={'method': ['POST']}) |
|
380 | conditions={'method': ['POST']}) | |
381 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
381 | m.connect('admin_settings_vcs', '/settings/vcs', | |
382 | action='settings_vcs', |
|
382 | action='settings_vcs', | |
383 | conditions={'method': ['GET']}) |
|
383 | conditions={'method': ['GET']}) | |
384 | m.connect('admin_settings_vcs', '/settings/vcs', |
|
384 | m.connect('admin_settings_vcs', '/settings/vcs', | |
385 | action='delete_svn_pattern', |
|
385 | action='delete_svn_pattern', | |
386 | conditions={'method': ['DELETE']}) |
|
386 | conditions={'method': ['DELETE']}) | |
387 |
|
387 | |||
388 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
388 | m.connect('admin_settings_mapping', '/settings/mapping', | |
389 | action='settings_mapping_update', |
|
389 | action='settings_mapping_update', | |
390 | conditions={'method': ['POST']}) |
|
390 | conditions={'method': ['POST']}) | |
391 | m.connect('admin_settings_mapping', '/settings/mapping', |
|
391 | m.connect('admin_settings_mapping', '/settings/mapping', | |
392 | action='settings_mapping', conditions={'method': ['GET']}) |
|
392 | action='settings_mapping', conditions={'method': ['GET']}) | |
393 |
|
393 | |||
394 | m.connect('admin_settings_global', '/settings/global', |
|
394 | m.connect('admin_settings_global', '/settings/global', | |
395 | action='settings_global_update', |
|
395 | action='settings_global_update', | |
396 | conditions={'method': ['POST']}) |
|
396 | conditions={'method': ['POST']}) | |
397 | m.connect('admin_settings_global', '/settings/global', |
|
397 | m.connect('admin_settings_global', '/settings/global', | |
398 | action='settings_global', conditions={'method': ['GET']}) |
|
398 | action='settings_global', conditions={'method': ['GET']}) | |
399 |
|
399 | |||
400 | m.connect('admin_settings_visual', '/settings/visual', |
|
400 | m.connect('admin_settings_visual', '/settings/visual', | |
401 | action='settings_visual_update', |
|
401 | action='settings_visual_update', | |
402 | conditions={'method': ['POST']}) |
|
402 | conditions={'method': ['POST']}) | |
403 | m.connect('admin_settings_visual', '/settings/visual', |
|
403 | m.connect('admin_settings_visual', '/settings/visual', | |
404 | action='settings_visual', conditions={'method': ['GET']}) |
|
404 | action='settings_visual', conditions={'method': ['GET']}) | |
405 |
|
405 | |||
406 | m.connect('admin_settings_issuetracker', |
|
406 | m.connect('admin_settings_issuetracker', | |
407 | '/settings/issue-tracker', action='settings_issuetracker', |
|
407 | '/settings/issue-tracker', action='settings_issuetracker', | |
408 | conditions={'method': ['GET']}) |
|
408 | conditions={'method': ['GET']}) | |
409 | m.connect('admin_settings_issuetracker_save', |
|
409 | m.connect('admin_settings_issuetracker_save', | |
410 | '/settings/issue-tracker/save', |
|
410 | '/settings/issue-tracker/save', | |
411 | action='settings_issuetracker_save', |
|
411 | action='settings_issuetracker_save', | |
412 | conditions={'method': ['POST']}) |
|
412 | conditions={'method': ['POST']}) | |
413 | m.connect('admin_issuetracker_test', '/settings/issue-tracker/test', |
|
413 | m.connect('admin_issuetracker_test', '/settings/issue-tracker/test', | |
414 | action='settings_issuetracker_test', |
|
414 | action='settings_issuetracker_test', | |
415 | conditions={'method': ['POST']}) |
|
415 | conditions={'method': ['POST']}) | |
416 | m.connect('admin_issuetracker_delete', |
|
416 | m.connect('admin_issuetracker_delete', | |
417 | '/settings/issue-tracker/delete', |
|
417 | '/settings/issue-tracker/delete', | |
418 | action='settings_issuetracker_delete', |
|
418 | action='settings_issuetracker_delete', | |
419 | conditions={'method': ['DELETE']}) |
|
419 | conditions={'method': ['DELETE']}) | |
420 |
|
420 | |||
421 | m.connect('admin_settings_email', '/settings/email', |
|
421 | m.connect('admin_settings_email', '/settings/email', | |
422 | action='settings_email_update', |
|
422 | action='settings_email_update', | |
423 | conditions={'method': ['POST']}) |
|
423 | conditions={'method': ['POST']}) | |
424 | m.connect('admin_settings_email', '/settings/email', |
|
424 | m.connect('admin_settings_email', '/settings/email', | |
425 | action='settings_email', conditions={'method': ['GET']}) |
|
425 | action='settings_email', conditions={'method': ['GET']}) | |
426 |
|
426 | |||
427 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
427 | m.connect('admin_settings_hooks', '/settings/hooks', | |
428 | action='settings_hooks_update', |
|
428 | action='settings_hooks_update', | |
429 | conditions={'method': ['POST', 'DELETE']}) |
|
429 | conditions={'method': ['POST', 'DELETE']}) | |
430 | m.connect('admin_settings_hooks', '/settings/hooks', |
|
430 | m.connect('admin_settings_hooks', '/settings/hooks', | |
431 | action='settings_hooks', conditions={'method': ['GET']}) |
|
431 | action='settings_hooks', conditions={'method': ['GET']}) | |
432 |
|
432 | |||
433 | m.connect('admin_settings_search', '/settings/search', |
|
433 | m.connect('admin_settings_search', '/settings/search', | |
434 | action='settings_search', conditions={'method': ['GET']}) |
|
434 | action='settings_search', conditions={'method': ['GET']}) | |
435 |
|
435 | |||
436 | m.connect('admin_settings_system', '/settings/system', |
|
436 | m.connect('admin_settings_system', '/settings/system', | |
437 | action='settings_system', conditions={'method': ['GET']}) |
|
437 | action='settings_system', conditions={'method': ['GET']}) | |
438 |
|
438 | |||
439 | m.connect('admin_settings_system_update', '/settings/system/updates', |
|
439 | m.connect('admin_settings_system_update', '/settings/system/updates', | |
440 | action='settings_system_update', conditions={'method': ['GET']}) |
|
440 | action='settings_system_update', conditions={'method': ['GET']}) | |
441 |
|
441 | |||
442 | m.connect('admin_settings_supervisor', '/settings/supervisor', |
|
442 | m.connect('admin_settings_supervisor', '/settings/supervisor', | |
443 | action='settings_supervisor', conditions={'method': ['GET']}) |
|
443 | action='settings_supervisor', conditions={'method': ['GET']}) | |
444 | m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log', |
|
444 | m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log', | |
445 | action='settings_supervisor_log', conditions={'method': ['GET']}) |
|
445 | action='settings_supervisor_log', conditions={'method': ['GET']}) | |
446 |
|
446 | |||
447 | m.connect('admin_settings_labs', '/settings/labs', |
|
447 | m.connect('admin_settings_labs', '/settings/labs', | |
448 | action='settings_labs_update', |
|
448 | action='settings_labs_update', | |
449 | conditions={'method': ['POST']}) |
|
449 | conditions={'method': ['POST']}) | |
450 | m.connect('admin_settings_labs', '/settings/labs', |
|
450 | m.connect('admin_settings_labs', '/settings/labs', | |
451 | action='settings_labs', conditions={'method': ['GET']}) |
|
451 | action='settings_labs', conditions={'method': ['GET']}) | |
452 |
|
452 | |||
453 | m.connect('admin_settings_open_source', '/settings/open_source', |
|
453 | m.connect('admin_settings_open_source', '/settings/open_source', | |
454 | action='settings_open_source', |
|
454 | action='settings_open_source', | |
455 | conditions={'method': ['GET']}) |
|
455 | conditions={'method': ['GET']}) | |
456 |
|
456 | |||
457 | # ADMIN MY ACCOUNT |
|
457 | # ADMIN MY ACCOUNT | |
458 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
458 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
459 | controller='admin/my_account') as m: |
|
459 | controller='admin/my_account') as m: | |
460 |
|
460 | |||
461 | m.connect('my_account', '/my_account', |
|
461 | m.connect('my_account', '/my_account', | |
462 | action='my_account', conditions={'method': ['GET']}) |
|
462 | action='my_account', conditions={'method': ['GET']}) | |
463 | m.connect('my_account_edit', '/my_account/edit', |
|
463 | m.connect('my_account_edit', '/my_account/edit', | |
464 | action='my_account_edit', conditions={'method': ['GET']}) |
|
464 | action='my_account_edit', conditions={'method': ['GET']}) | |
465 | m.connect('my_account', '/my_account', |
|
465 | m.connect('my_account', '/my_account', | |
466 | action='my_account_update', conditions={'method': ['POST']}) |
|
466 | action='my_account_update', conditions={'method': ['POST']}) | |
467 |
|
467 | |||
468 | m.connect('my_account_password', '/my_account/password', |
|
468 | m.connect('my_account_password', '/my_account/password', | |
469 | action='my_account_password', conditions={'method': ['GET']}) |
|
469 | action='my_account_password', conditions={'method': ['GET']}) | |
470 | m.connect('my_account_password', '/my_account/password', |
|
470 | m.connect('my_account_password', '/my_account/password', | |
471 | action='my_account_password_update', conditions={'method': ['POST']}) |
|
471 | action='my_account_password_update', conditions={'method': ['POST']}) | |
472 |
|
472 | |||
473 | m.connect('my_account_repos', '/my_account/repos', |
|
473 | m.connect('my_account_repos', '/my_account/repos', | |
474 | action='my_account_repos', conditions={'method': ['GET']}) |
|
474 | action='my_account_repos', conditions={'method': ['GET']}) | |
475 |
|
475 | |||
476 | m.connect('my_account_watched', '/my_account/watched', |
|
476 | m.connect('my_account_watched', '/my_account/watched', | |
477 | action='my_account_watched', conditions={'method': ['GET']}) |
|
477 | action='my_account_watched', conditions={'method': ['GET']}) | |
478 |
|
478 | |||
479 | m.connect('my_account_pullrequests', '/my_account/pull_requests', |
|
479 | m.connect('my_account_pullrequests', '/my_account/pull_requests', | |
480 | action='my_account_pullrequests', conditions={'method': ['GET']}) |
|
480 | action='my_account_pullrequests', conditions={'method': ['GET']}) | |
481 |
|
481 | |||
482 | m.connect('my_account_perms', '/my_account/perms', |
|
482 | m.connect('my_account_perms', '/my_account/perms', | |
483 | action='my_account_perms', conditions={'method': ['GET']}) |
|
483 | action='my_account_perms', conditions={'method': ['GET']}) | |
484 |
|
484 | |||
485 | m.connect('my_account_emails', '/my_account/emails', |
|
485 | m.connect('my_account_emails', '/my_account/emails', | |
486 | action='my_account_emails', conditions={'method': ['GET']}) |
|
486 | action='my_account_emails', conditions={'method': ['GET']}) | |
487 | m.connect('my_account_emails', '/my_account/emails', |
|
487 | m.connect('my_account_emails', '/my_account/emails', | |
488 | action='my_account_emails_add', conditions={'method': ['POST']}) |
|
488 | action='my_account_emails_add', conditions={'method': ['POST']}) | |
489 | m.connect('my_account_emails', '/my_account/emails', |
|
489 | m.connect('my_account_emails', '/my_account/emails', | |
490 | action='my_account_emails_delete', conditions={'method': ['DELETE']}) |
|
490 | action='my_account_emails_delete', conditions={'method': ['DELETE']}) | |
491 |
|
491 | |||
492 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
492 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', | |
493 | action='my_account_auth_tokens', conditions={'method': ['GET']}) |
|
493 | action='my_account_auth_tokens', conditions={'method': ['GET']}) | |
494 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
494 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', | |
495 | action='my_account_auth_tokens_add', conditions={'method': ['POST']}) |
|
495 | action='my_account_auth_tokens_add', conditions={'method': ['POST']}) | |
496 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', |
|
496 | m.connect('my_account_auth_tokens', '/my_account/auth_tokens', | |
497 | action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']}) |
|
497 | action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']}) | |
498 |
|
498 | |||
499 | # NOTIFICATION REST ROUTES |
|
499 | # NOTIFICATION REST ROUTES | |
500 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
500 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
501 | controller='admin/notifications') as m: |
|
501 | controller='admin/notifications') as m: | |
502 | m.connect('notifications', '/notifications', |
|
502 | m.connect('notifications', '/notifications', | |
503 | action='index', conditions={'method': ['GET']}) |
|
503 | action='index', conditions={'method': ['GET']}) | |
504 | m.connect('notifications_mark_all_read', '/notifications/mark_all_read', |
|
504 | m.connect('notifications_mark_all_read', '/notifications/mark_all_read', | |
505 | action='mark_all_read', conditions={'method': ['POST']}) |
|
505 | action='mark_all_read', conditions={'method': ['POST']}) | |
506 |
|
506 | |||
507 | m.connect('/notifications/{notification_id}', |
|
507 | m.connect('/notifications/{notification_id}', | |
508 | action='update', conditions={'method': ['PUT']}) |
|
508 | action='update', conditions={'method': ['PUT']}) | |
509 | m.connect('/notifications/{notification_id}', |
|
509 | m.connect('/notifications/{notification_id}', | |
510 | action='delete', conditions={'method': ['DELETE']}) |
|
510 | action='delete', conditions={'method': ['DELETE']}) | |
511 | m.connect('notification', '/notifications/{notification_id}', |
|
511 | m.connect('notification', '/notifications/{notification_id}', | |
512 | action='show', conditions={'method': ['GET']}) |
|
512 | action='show', conditions={'method': ['GET']}) | |
513 |
|
513 | |||
514 | # ADMIN GIST |
|
514 | # ADMIN GIST | |
515 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
515 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
516 | controller='admin/gists') as m: |
|
516 | controller='admin/gists') as m: | |
517 | m.connect('gists', '/gists', |
|
517 | m.connect('gists', '/gists', | |
518 | action='create', conditions={'method': ['POST']}) |
|
518 | action='create', conditions={'method': ['POST']}) | |
519 | m.connect('gists', '/gists', |
|
519 | m.connect('gists', '/gists', | |
520 | action='index', conditions={'method': ['GET']}) |
|
520 | action='index', conditions={'method': ['GET']}) | |
521 | m.connect('new_gist', '/gists/new', |
|
521 | m.connect('new_gist', '/gists/new', | |
522 | action='new', conditions={'method': ['GET']}) |
|
522 | action='new', conditions={'method': ['GET']}) | |
523 |
|
523 | |||
524 | m.connect('/gists/{gist_id}', |
|
524 | m.connect('/gists/{gist_id}', | |
525 | action='delete', conditions={'method': ['DELETE']}) |
|
525 | action='delete', conditions={'method': ['DELETE']}) | |
526 | m.connect('edit_gist', '/gists/{gist_id}/edit', |
|
526 | m.connect('edit_gist', '/gists/{gist_id}/edit', | |
527 | action='edit_form', conditions={'method': ['GET']}) |
|
527 | action='edit_form', conditions={'method': ['GET']}) | |
528 | m.connect('edit_gist', '/gists/{gist_id}/edit', |
|
528 | m.connect('edit_gist', '/gists/{gist_id}/edit', | |
529 | action='edit', conditions={'method': ['POST']}) |
|
529 | action='edit', conditions={'method': ['POST']}) | |
530 | m.connect( |
|
530 | m.connect( | |
531 | 'edit_gist_check_revision', '/gists/{gist_id}/edit/check_revision', |
|
531 | 'edit_gist_check_revision', '/gists/{gist_id}/edit/check_revision', | |
532 | action='check_revision', conditions={'method': ['GET']}) |
|
532 | action='check_revision', conditions={'method': ['GET']}) | |
533 |
|
533 | |||
534 | m.connect('gist', '/gists/{gist_id}', |
|
534 | m.connect('gist', '/gists/{gist_id}', | |
535 | action='show', conditions={'method': ['GET']}) |
|
535 | action='show', conditions={'method': ['GET']}) | |
536 | m.connect('gist_rev', '/gists/{gist_id}/{revision}', |
|
536 | m.connect('gist_rev', '/gists/{gist_id}/{revision}', | |
537 | revision='tip', |
|
537 | revision='tip', | |
538 | action='show', conditions={'method': ['GET']}) |
|
538 | action='show', conditions={'method': ['GET']}) | |
539 | m.connect('formatted_gist', '/gists/{gist_id}/{revision}/{format}', |
|
539 | m.connect('formatted_gist', '/gists/{gist_id}/{revision}/{format}', | |
540 | revision='tip', |
|
540 | revision='tip', | |
541 | action='show', conditions={'method': ['GET']}) |
|
541 | action='show', conditions={'method': ['GET']}) | |
542 | m.connect('formatted_gist_file', '/gists/{gist_id}/{revision}/{format}/{f_path}', |
|
542 | m.connect('formatted_gist_file', '/gists/{gist_id}/{revision}/{format}/{f_path}', | |
543 | revision='tip', |
|
543 | revision='tip', | |
544 | action='show', conditions={'method': ['GET']}, |
|
544 | action='show', conditions={'method': ['GET']}, | |
545 | requirements=URL_NAME_REQUIREMENTS) |
|
545 | requirements=URL_NAME_REQUIREMENTS) | |
546 |
|
546 | |||
547 | # ADMIN MAIN PAGES |
|
547 | # ADMIN MAIN PAGES | |
548 | with rmap.submapper(path_prefix=ADMIN_PREFIX, |
|
548 | with rmap.submapper(path_prefix=ADMIN_PREFIX, | |
549 | controller='admin/admin') as m: |
|
549 | controller='admin/admin') as m: | |
550 | m.connect('admin_home', '', action='index') |
|
550 | m.connect('admin_home', '', action='index') | |
551 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
551 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
552 | action='add_repo') |
|
552 | action='add_repo') | |
553 | m.connect( |
|
553 | m.connect( | |
554 | 'pull_requests_global', '/pull_requests/{pull_request_id:[0-9]+}', |
|
554 | 'pull_requests_global', '/pull_requests/{pull_request_id:[0-9]+}', | |
555 | action='pull_requests') |
|
555 | action='pull_requests') | |
556 |
|
556 | |||
557 | # USER JOURNAL |
|
557 | # USER JOURNAL | |
558 | rmap.connect('journal', '%s/journal' % (ADMIN_PREFIX,), |
|
558 | rmap.connect('journal', '%s/journal' % (ADMIN_PREFIX,), | |
559 | controller='journal', action='index') |
|
559 | controller='journal', action='index') | |
560 | rmap.connect('journal_rss', '%s/journal/rss' % (ADMIN_PREFIX,), |
|
560 | rmap.connect('journal_rss', '%s/journal/rss' % (ADMIN_PREFIX,), | |
561 | controller='journal', action='journal_rss') |
|
561 | controller='journal', action='journal_rss') | |
562 | rmap.connect('journal_atom', '%s/journal/atom' % (ADMIN_PREFIX,), |
|
562 | rmap.connect('journal_atom', '%s/journal/atom' % (ADMIN_PREFIX,), | |
563 | controller='journal', action='journal_atom') |
|
563 | controller='journal', action='journal_atom') | |
564 |
|
564 | |||
565 | rmap.connect('public_journal', '%s/public_journal' % (ADMIN_PREFIX,), |
|
565 | rmap.connect('public_journal', '%s/public_journal' % (ADMIN_PREFIX,), | |
566 | controller='journal', action='public_journal') |
|
566 | controller='journal', action='public_journal') | |
567 |
|
567 | |||
568 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % (ADMIN_PREFIX,), |
|
568 | rmap.connect('public_journal_rss', '%s/public_journal/rss' % (ADMIN_PREFIX,), | |
569 | controller='journal', action='public_journal_rss') |
|
569 | controller='journal', action='public_journal_rss') | |
570 |
|
570 | |||
571 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % (ADMIN_PREFIX,), |
|
571 | rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % (ADMIN_PREFIX,), | |
572 | controller='journal', action='public_journal_rss') |
|
572 | controller='journal', action='public_journal_rss') | |
573 |
|
573 | |||
574 | rmap.connect('public_journal_atom', |
|
574 | rmap.connect('public_journal_atom', | |
575 | '%s/public_journal/atom' % (ADMIN_PREFIX,), controller='journal', |
|
575 | '%s/public_journal/atom' % (ADMIN_PREFIX,), controller='journal', | |
576 | action='public_journal_atom') |
|
576 | action='public_journal_atom') | |
577 |
|
577 | |||
578 | rmap.connect('public_journal_atom_old', |
|
578 | rmap.connect('public_journal_atom_old', | |
579 | '%s/public_journal_atom' % (ADMIN_PREFIX,), controller='journal', |
|
579 | '%s/public_journal_atom' % (ADMIN_PREFIX,), controller='journal', | |
580 | action='public_journal_atom') |
|
580 | action='public_journal_atom') | |
581 |
|
581 | |||
582 | rmap.connect('toggle_following', '%s/toggle_following' % (ADMIN_PREFIX,), |
|
582 | rmap.connect('toggle_following', '%s/toggle_following' % (ADMIN_PREFIX,), | |
583 | controller='journal', action='toggle_following', |
|
583 | controller='journal', action='toggle_following', | |
584 | conditions={'method': ['POST']}) |
|
584 | conditions={'method': ['POST']}) | |
585 |
|
585 | |||
586 | # FULL TEXT SEARCH |
|
586 | # FULL TEXT SEARCH | |
587 | rmap.connect('search', '%s/search' % (ADMIN_PREFIX,), |
|
587 | rmap.connect('search', '%s/search' % (ADMIN_PREFIX,), | |
588 | controller='search') |
|
588 | controller='search') | |
589 | rmap.connect('search_repo_home', '/{repo_name}/search', |
|
589 | rmap.connect('search_repo_home', '/{repo_name}/search', | |
590 | controller='search', |
|
590 | controller='search', | |
591 | action='index', |
|
591 | action='index', | |
592 | conditions={'function': check_repo}, |
|
592 | conditions={'function': check_repo}, | |
593 | requirements=URL_NAME_REQUIREMENTS) |
|
593 | requirements=URL_NAME_REQUIREMENTS) | |
594 |
|
594 | |||
595 | # LOGIN/LOGOUT/REGISTER/SIGN IN |
|
|||
596 | rmap.connect('login_home', '%s/login' % (ADMIN_PREFIX,), controller='login', |
|
|||
597 | action='index') |
|
|||
598 |
|
||||
599 | rmap.connect('logout_home', '%s/logout' % (ADMIN_PREFIX,), controller='login', |
|
|||
600 | action='logout', conditions={'method': ['POST']}) |
|
|||
601 |
|
||||
602 | rmap.connect('register', '%s/register' % (ADMIN_PREFIX,), controller='login', |
|
|||
603 | action='register') |
|
|||
604 |
|
||||
605 | rmap.connect('reset_password', '%s/password_reset' % (ADMIN_PREFIX,), |
|
|||
606 | controller='login', action='password_reset') |
|
|||
607 |
|
||||
608 | rmap.connect('reset_password_confirmation', |
|
|||
609 | '%s/password_reset_confirmation' % (ADMIN_PREFIX,), |
|
|||
610 | controller='login', action='password_reset_confirmation') |
|
|||
611 |
|
||||
612 | rmap.connect('social_auth', |
|
|||
613 | '%s/social_auth/{provider_name}' % (ADMIN_PREFIX,), |
|
|||
614 | controller='login', action='social_auth') |
|
|||
615 |
|
||||
616 | # FEEDS |
|
595 | # FEEDS | |
617 | rmap.connect('rss_feed_home', '/{repo_name}/feed/rss', |
|
596 | rmap.connect('rss_feed_home', '/{repo_name}/feed/rss', | |
618 | controller='feed', action='rss', |
|
597 | controller='feed', action='rss', | |
619 | conditions={'function': check_repo}, |
|
598 | conditions={'function': check_repo}, | |
620 | requirements=URL_NAME_REQUIREMENTS) |
|
599 | requirements=URL_NAME_REQUIREMENTS) | |
621 |
|
600 | |||
622 | rmap.connect('atom_feed_home', '/{repo_name}/feed/atom', |
|
601 | rmap.connect('atom_feed_home', '/{repo_name}/feed/atom', | |
623 | controller='feed', action='atom', |
|
602 | controller='feed', action='atom', | |
624 | conditions={'function': check_repo}, |
|
603 | conditions={'function': check_repo}, | |
625 | requirements=URL_NAME_REQUIREMENTS) |
|
604 | requirements=URL_NAME_REQUIREMENTS) | |
626 |
|
605 | |||
627 | #========================================================================== |
|
606 | #========================================================================== | |
628 | # REPOSITORY ROUTES |
|
607 | # REPOSITORY ROUTES | |
629 | #========================================================================== |
|
608 | #========================================================================== | |
630 |
|
609 | |||
631 | rmap.connect('repo_creating_home', '/{repo_name}/repo_creating', |
|
610 | rmap.connect('repo_creating_home', '/{repo_name}/repo_creating', | |
632 | controller='admin/repos', action='repo_creating', |
|
611 | controller='admin/repos', action='repo_creating', | |
633 | requirements=URL_NAME_REQUIREMENTS) |
|
612 | requirements=URL_NAME_REQUIREMENTS) | |
634 | rmap.connect('repo_check_home', '/{repo_name}/crepo_check', |
|
613 | rmap.connect('repo_check_home', '/{repo_name}/crepo_check', | |
635 | controller='admin/repos', action='repo_check', |
|
614 | controller='admin/repos', action='repo_check', | |
636 | requirements=URL_NAME_REQUIREMENTS) |
|
615 | requirements=URL_NAME_REQUIREMENTS) | |
637 |
|
616 | |||
638 | rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}', |
|
617 | rmap.connect('repo_stats', '/{repo_name}/repo_stats/{commit_id}', | |
639 | controller='summary', action='repo_stats', |
|
618 | controller='summary', action='repo_stats', | |
640 | conditions={'function': check_repo}, |
|
619 | conditions={'function': check_repo}, | |
641 | requirements=URL_NAME_REQUIREMENTS) |
|
620 | requirements=URL_NAME_REQUIREMENTS) | |
642 |
|
621 | |||
643 | rmap.connect('repo_refs_data', '/{repo_name}/refs-data', |
|
622 | rmap.connect('repo_refs_data', '/{repo_name}/refs-data', | |
644 | controller='summary', action='repo_refs_data', |
|
623 | controller='summary', action='repo_refs_data', | |
645 | requirements=URL_NAME_REQUIREMENTS) |
|
624 | requirements=URL_NAME_REQUIREMENTS) | |
646 | rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog', |
|
625 | rmap.connect('repo_refs_changelog_data', '/{repo_name}/refs-data-changelog', | |
647 | controller='summary', action='repo_refs_changelog_data', |
|
626 | controller='summary', action='repo_refs_changelog_data', | |
648 | requirements=URL_NAME_REQUIREMENTS) |
|
627 | requirements=URL_NAME_REQUIREMENTS) | |
649 |
|
628 | |||
650 | rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}', |
|
629 | rmap.connect('changeset_home', '/{repo_name}/changeset/{revision}', | |
651 | controller='changeset', revision='tip', |
|
630 | controller='changeset', revision='tip', | |
652 | conditions={'function': check_repo}, |
|
631 | conditions={'function': check_repo}, | |
653 | requirements=URL_NAME_REQUIREMENTS) |
|
632 | requirements=URL_NAME_REQUIREMENTS) | |
654 | rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}', |
|
633 | rmap.connect('changeset_children', '/{repo_name}/changeset_children/{revision}', | |
655 | controller='changeset', revision='tip', action='changeset_children', |
|
634 | controller='changeset', revision='tip', action='changeset_children', | |
656 | conditions={'function': check_repo}, |
|
635 | conditions={'function': check_repo}, | |
657 | requirements=URL_NAME_REQUIREMENTS) |
|
636 | requirements=URL_NAME_REQUIREMENTS) | |
658 | rmap.connect('changeset_parents', '/{repo_name}/changeset_parents/{revision}', |
|
637 | rmap.connect('changeset_parents', '/{repo_name}/changeset_parents/{revision}', | |
659 | controller='changeset', revision='tip', action='changeset_parents', |
|
638 | controller='changeset', revision='tip', action='changeset_parents', | |
660 | conditions={'function': check_repo}, |
|
639 | conditions={'function': check_repo}, | |
661 | requirements=URL_NAME_REQUIREMENTS) |
|
640 | requirements=URL_NAME_REQUIREMENTS) | |
662 |
|
641 | |||
663 | # repo edit options |
|
642 | # repo edit options | |
664 | rmap.connect('edit_repo', '/{repo_name}/settings', |
|
643 | rmap.connect('edit_repo', '/{repo_name}/settings', | |
665 | controller='admin/repos', action='edit', |
|
644 | controller='admin/repos', action='edit', | |
666 | conditions={'method': ['GET'], 'function': check_repo}, |
|
645 | conditions={'method': ['GET'], 'function': check_repo}, | |
667 | requirements=URL_NAME_REQUIREMENTS) |
|
646 | requirements=URL_NAME_REQUIREMENTS) | |
668 |
|
647 | |||
669 | rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions', |
|
648 | rmap.connect('edit_repo_perms', '/{repo_name}/settings/permissions', | |
670 | controller='admin/repos', action='edit_permissions', |
|
649 | controller='admin/repos', action='edit_permissions', | |
671 | conditions={'method': ['GET'], 'function': check_repo}, |
|
650 | conditions={'method': ['GET'], 'function': check_repo}, | |
672 | requirements=URL_NAME_REQUIREMENTS) |
|
651 | requirements=URL_NAME_REQUIREMENTS) | |
673 | rmap.connect('edit_repo_perms_update', '/{repo_name}/settings/permissions', |
|
652 | rmap.connect('edit_repo_perms_update', '/{repo_name}/settings/permissions', | |
674 | controller='admin/repos', action='edit_permissions_update', |
|
653 | controller='admin/repos', action='edit_permissions_update', | |
675 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
654 | conditions={'method': ['PUT'], 'function': check_repo}, | |
676 | requirements=URL_NAME_REQUIREMENTS) |
|
655 | requirements=URL_NAME_REQUIREMENTS) | |
677 |
|
656 | |||
678 | rmap.connect('edit_repo_fields', '/{repo_name}/settings/fields', |
|
657 | rmap.connect('edit_repo_fields', '/{repo_name}/settings/fields', | |
679 | controller='admin/repos', action='edit_fields', |
|
658 | controller='admin/repos', action='edit_fields', | |
680 | conditions={'method': ['GET'], 'function': check_repo}, |
|
659 | conditions={'method': ['GET'], 'function': check_repo}, | |
681 | requirements=URL_NAME_REQUIREMENTS) |
|
660 | requirements=URL_NAME_REQUIREMENTS) | |
682 | rmap.connect('create_repo_fields', '/{repo_name}/settings/fields/new', |
|
661 | rmap.connect('create_repo_fields', '/{repo_name}/settings/fields/new', | |
683 | controller='admin/repos', action='create_repo_field', |
|
662 | controller='admin/repos', action='create_repo_field', | |
684 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
663 | conditions={'method': ['PUT'], 'function': check_repo}, | |
685 | requirements=URL_NAME_REQUIREMENTS) |
|
664 | requirements=URL_NAME_REQUIREMENTS) | |
686 | rmap.connect('delete_repo_fields', '/{repo_name}/settings/fields/{field_id}', |
|
665 | rmap.connect('delete_repo_fields', '/{repo_name}/settings/fields/{field_id}', | |
687 | controller='admin/repos', action='delete_repo_field', |
|
666 | controller='admin/repos', action='delete_repo_field', | |
688 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
667 | conditions={'method': ['DELETE'], 'function': check_repo}, | |
689 | requirements=URL_NAME_REQUIREMENTS) |
|
668 | requirements=URL_NAME_REQUIREMENTS) | |
690 |
|
669 | |||
691 | rmap.connect('edit_repo_advanced', '/{repo_name}/settings/advanced', |
|
670 | rmap.connect('edit_repo_advanced', '/{repo_name}/settings/advanced', | |
692 | controller='admin/repos', action='edit_advanced', |
|
671 | controller='admin/repos', action='edit_advanced', | |
693 | conditions={'method': ['GET'], 'function': check_repo}, |
|
672 | conditions={'method': ['GET'], 'function': check_repo}, | |
694 | requirements=URL_NAME_REQUIREMENTS) |
|
673 | requirements=URL_NAME_REQUIREMENTS) | |
695 |
|
674 | |||
696 | rmap.connect('edit_repo_advanced_locking', '/{repo_name}/settings/advanced/locking', |
|
675 | rmap.connect('edit_repo_advanced_locking', '/{repo_name}/settings/advanced/locking', | |
697 | controller='admin/repos', action='edit_advanced_locking', |
|
676 | controller='admin/repos', action='edit_advanced_locking', | |
698 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
677 | conditions={'method': ['PUT'], 'function': check_repo}, | |
699 | requirements=URL_NAME_REQUIREMENTS) |
|
678 | requirements=URL_NAME_REQUIREMENTS) | |
700 | rmap.connect('toggle_locking', '/{repo_name}/settings/advanced/locking_toggle', |
|
679 | rmap.connect('toggle_locking', '/{repo_name}/settings/advanced/locking_toggle', | |
701 | controller='admin/repos', action='toggle_locking', |
|
680 | controller='admin/repos', action='toggle_locking', | |
702 | conditions={'method': ['GET'], 'function': check_repo}, |
|
681 | conditions={'method': ['GET'], 'function': check_repo}, | |
703 | requirements=URL_NAME_REQUIREMENTS) |
|
682 | requirements=URL_NAME_REQUIREMENTS) | |
704 |
|
683 | |||
705 | rmap.connect('edit_repo_advanced_journal', '/{repo_name}/settings/advanced/journal', |
|
684 | rmap.connect('edit_repo_advanced_journal', '/{repo_name}/settings/advanced/journal', | |
706 | controller='admin/repos', action='edit_advanced_journal', |
|
685 | controller='admin/repos', action='edit_advanced_journal', | |
707 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
686 | conditions={'method': ['PUT'], 'function': check_repo}, | |
708 | requirements=URL_NAME_REQUIREMENTS) |
|
687 | requirements=URL_NAME_REQUIREMENTS) | |
709 |
|
688 | |||
710 | rmap.connect('edit_repo_advanced_fork', '/{repo_name}/settings/advanced/fork', |
|
689 | rmap.connect('edit_repo_advanced_fork', '/{repo_name}/settings/advanced/fork', | |
711 | controller='admin/repos', action='edit_advanced_fork', |
|
690 | controller='admin/repos', action='edit_advanced_fork', | |
712 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
691 | conditions={'method': ['PUT'], 'function': check_repo}, | |
713 | requirements=URL_NAME_REQUIREMENTS) |
|
692 | requirements=URL_NAME_REQUIREMENTS) | |
714 |
|
693 | |||
715 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', |
|
694 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', | |
716 | controller='admin/repos', action='edit_caches_form', |
|
695 | controller='admin/repos', action='edit_caches_form', | |
717 | conditions={'method': ['GET'], 'function': check_repo}, |
|
696 | conditions={'method': ['GET'], 'function': check_repo}, | |
718 | requirements=URL_NAME_REQUIREMENTS) |
|
697 | requirements=URL_NAME_REQUIREMENTS) | |
719 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', |
|
698 | rmap.connect('edit_repo_caches', '/{repo_name}/settings/caches', | |
720 | controller='admin/repos', action='edit_caches', |
|
699 | controller='admin/repos', action='edit_caches', | |
721 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
700 | conditions={'method': ['PUT'], 'function': check_repo}, | |
722 | requirements=URL_NAME_REQUIREMENTS) |
|
701 | requirements=URL_NAME_REQUIREMENTS) | |
723 |
|
702 | |||
724 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', |
|
703 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', | |
725 | controller='admin/repos', action='edit_remote_form', |
|
704 | controller='admin/repos', action='edit_remote_form', | |
726 | conditions={'method': ['GET'], 'function': check_repo}, |
|
705 | conditions={'method': ['GET'], 'function': check_repo}, | |
727 | requirements=URL_NAME_REQUIREMENTS) |
|
706 | requirements=URL_NAME_REQUIREMENTS) | |
728 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', |
|
707 | rmap.connect('edit_repo_remote', '/{repo_name}/settings/remote', | |
729 | controller='admin/repos', action='edit_remote', |
|
708 | controller='admin/repos', action='edit_remote', | |
730 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
709 | conditions={'method': ['PUT'], 'function': check_repo}, | |
731 | requirements=URL_NAME_REQUIREMENTS) |
|
710 | requirements=URL_NAME_REQUIREMENTS) | |
732 |
|
711 | |||
733 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', |
|
712 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', | |
734 | controller='admin/repos', action='edit_statistics_form', |
|
713 | controller='admin/repos', action='edit_statistics_form', | |
735 | conditions={'method': ['GET'], 'function': check_repo}, |
|
714 | conditions={'method': ['GET'], 'function': check_repo}, | |
736 | requirements=URL_NAME_REQUIREMENTS) |
|
715 | requirements=URL_NAME_REQUIREMENTS) | |
737 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', |
|
716 | rmap.connect('edit_repo_statistics', '/{repo_name}/settings/statistics', | |
738 | controller='admin/repos', action='edit_statistics', |
|
717 | controller='admin/repos', action='edit_statistics', | |
739 | conditions={'method': ['PUT'], 'function': check_repo}, |
|
718 | conditions={'method': ['PUT'], 'function': check_repo}, | |
740 | requirements=URL_NAME_REQUIREMENTS) |
|
719 | requirements=URL_NAME_REQUIREMENTS) | |
741 | rmap.connect('repo_settings_issuetracker', |
|
720 | rmap.connect('repo_settings_issuetracker', | |
742 | '/{repo_name}/settings/issue-tracker', |
|
721 | '/{repo_name}/settings/issue-tracker', | |
743 | controller='admin/repos', action='repo_issuetracker', |
|
722 | controller='admin/repos', action='repo_issuetracker', | |
744 | conditions={'method': ['GET'], 'function': check_repo}, |
|
723 | conditions={'method': ['GET'], 'function': check_repo}, | |
745 | requirements=URL_NAME_REQUIREMENTS) |
|
724 | requirements=URL_NAME_REQUIREMENTS) | |
746 | rmap.connect('repo_issuetracker_test', |
|
725 | rmap.connect('repo_issuetracker_test', | |
747 | '/{repo_name}/settings/issue-tracker/test', |
|
726 | '/{repo_name}/settings/issue-tracker/test', | |
748 | controller='admin/repos', action='repo_issuetracker_test', |
|
727 | controller='admin/repos', action='repo_issuetracker_test', | |
749 | conditions={'method': ['POST'], 'function': check_repo}, |
|
728 | conditions={'method': ['POST'], 'function': check_repo}, | |
750 | requirements=URL_NAME_REQUIREMENTS) |
|
729 | requirements=URL_NAME_REQUIREMENTS) | |
751 | rmap.connect('repo_issuetracker_delete', |
|
730 | rmap.connect('repo_issuetracker_delete', | |
752 | '/{repo_name}/settings/issue-tracker/delete', |
|
731 | '/{repo_name}/settings/issue-tracker/delete', | |
753 | controller='admin/repos', action='repo_issuetracker_delete', |
|
732 | controller='admin/repos', action='repo_issuetracker_delete', | |
754 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
733 | conditions={'method': ['DELETE'], 'function': check_repo}, | |
755 | requirements=URL_NAME_REQUIREMENTS) |
|
734 | requirements=URL_NAME_REQUIREMENTS) | |
756 | rmap.connect('repo_issuetracker_save', |
|
735 | rmap.connect('repo_issuetracker_save', | |
757 | '/{repo_name}/settings/issue-tracker/save', |
|
736 | '/{repo_name}/settings/issue-tracker/save', | |
758 | controller='admin/repos', action='repo_issuetracker_save', |
|
737 | controller='admin/repos', action='repo_issuetracker_save', | |
759 | conditions={'method': ['POST'], 'function': check_repo}, |
|
738 | conditions={'method': ['POST'], 'function': check_repo}, | |
760 | requirements=URL_NAME_REQUIREMENTS) |
|
739 | requirements=URL_NAME_REQUIREMENTS) | |
761 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
740 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', | |
762 | controller='admin/repos', action='repo_settings_vcs_update', |
|
741 | controller='admin/repos', action='repo_settings_vcs_update', | |
763 | conditions={'method': ['POST'], 'function': check_repo}, |
|
742 | conditions={'method': ['POST'], 'function': check_repo}, | |
764 | requirements=URL_NAME_REQUIREMENTS) |
|
743 | requirements=URL_NAME_REQUIREMENTS) | |
765 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
744 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', | |
766 | controller='admin/repos', action='repo_settings_vcs', |
|
745 | controller='admin/repos', action='repo_settings_vcs', | |
767 | conditions={'method': ['GET'], 'function': check_repo}, |
|
746 | conditions={'method': ['GET'], 'function': check_repo}, | |
768 | requirements=URL_NAME_REQUIREMENTS) |
|
747 | requirements=URL_NAME_REQUIREMENTS) | |
769 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', |
|
748 | rmap.connect('repo_vcs_settings', '/{repo_name}/settings/vcs', | |
770 | controller='admin/repos', action='repo_delete_svn_pattern', |
|
749 | controller='admin/repos', action='repo_delete_svn_pattern', | |
771 | conditions={'method': ['DELETE'], 'function': check_repo}, |
|
750 | conditions={'method': ['DELETE'], 'function': check_repo}, | |
772 | requirements=URL_NAME_REQUIREMENTS) |
|
751 | requirements=URL_NAME_REQUIREMENTS) | |
773 |
|
752 | |||
774 | # still working url for backward compat. |
|
753 | # still working url for backward compat. | |
775 | rmap.connect('raw_changeset_home_depraced', |
|
754 | rmap.connect('raw_changeset_home_depraced', | |
776 | '/{repo_name}/raw-changeset/{revision}', |
|
755 | '/{repo_name}/raw-changeset/{revision}', | |
777 | controller='changeset', action='changeset_raw', |
|
756 | controller='changeset', action='changeset_raw', | |
778 | revision='tip', conditions={'function': check_repo}, |
|
757 | revision='tip', conditions={'function': check_repo}, | |
779 | requirements=URL_NAME_REQUIREMENTS) |
|
758 | requirements=URL_NAME_REQUIREMENTS) | |
780 |
|
759 | |||
781 | # new URLs |
|
760 | # new URLs | |
782 | rmap.connect('changeset_raw_home', |
|
761 | rmap.connect('changeset_raw_home', | |
783 | '/{repo_name}/changeset-diff/{revision}', |
|
762 | '/{repo_name}/changeset-diff/{revision}', | |
784 | controller='changeset', action='changeset_raw', |
|
763 | controller='changeset', action='changeset_raw', | |
785 | revision='tip', conditions={'function': check_repo}, |
|
764 | revision='tip', conditions={'function': check_repo}, | |
786 | requirements=URL_NAME_REQUIREMENTS) |
|
765 | requirements=URL_NAME_REQUIREMENTS) | |
787 |
|
766 | |||
788 | rmap.connect('changeset_patch_home', |
|
767 | rmap.connect('changeset_patch_home', | |
789 | '/{repo_name}/changeset-patch/{revision}', |
|
768 | '/{repo_name}/changeset-patch/{revision}', | |
790 | controller='changeset', action='changeset_patch', |
|
769 | controller='changeset', action='changeset_patch', | |
791 | revision='tip', conditions={'function': check_repo}, |
|
770 | revision='tip', conditions={'function': check_repo}, | |
792 | requirements=URL_NAME_REQUIREMENTS) |
|
771 | requirements=URL_NAME_REQUIREMENTS) | |
793 |
|
772 | |||
794 | rmap.connect('changeset_download_home', |
|
773 | rmap.connect('changeset_download_home', | |
795 | '/{repo_name}/changeset-download/{revision}', |
|
774 | '/{repo_name}/changeset-download/{revision}', | |
796 | controller='changeset', action='changeset_download', |
|
775 | controller='changeset', action='changeset_download', | |
797 | revision='tip', conditions={'function': check_repo}, |
|
776 | revision='tip', conditions={'function': check_repo}, | |
798 | requirements=URL_NAME_REQUIREMENTS) |
|
777 | requirements=URL_NAME_REQUIREMENTS) | |
799 |
|
778 | |||
800 | rmap.connect('changeset_comment', |
|
779 | rmap.connect('changeset_comment', | |
801 | '/{repo_name}/changeset/{revision}/comment', |
|
780 | '/{repo_name}/changeset/{revision}/comment', | |
802 | controller='changeset', revision='tip', action='comment', |
|
781 | controller='changeset', revision='tip', action='comment', | |
803 | conditions={'function': check_repo}, |
|
782 | conditions={'function': check_repo}, | |
804 | requirements=URL_NAME_REQUIREMENTS) |
|
783 | requirements=URL_NAME_REQUIREMENTS) | |
805 |
|
784 | |||
806 | rmap.connect('changeset_comment_preview', |
|
785 | rmap.connect('changeset_comment_preview', | |
807 | '/{repo_name}/changeset/comment/preview', |
|
786 | '/{repo_name}/changeset/comment/preview', | |
808 | controller='changeset', action='preview_comment', |
|
787 | controller='changeset', action='preview_comment', | |
809 | conditions={'function': check_repo, 'method': ['POST']}, |
|
788 | conditions={'function': check_repo, 'method': ['POST']}, | |
810 | requirements=URL_NAME_REQUIREMENTS) |
|
789 | requirements=URL_NAME_REQUIREMENTS) | |
811 |
|
790 | |||
812 | rmap.connect('changeset_comment_delete', |
|
791 | rmap.connect('changeset_comment_delete', | |
813 | '/{repo_name}/changeset/comment/{comment_id}/delete', |
|
792 | '/{repo_name}/changeset/comment/{comment_id}/delete', | |
814 | controller='changeset', action='delete_comment', |
|
793 | controller='changeset', action='delete_comment', | |
815 | conditions={'function': check_repo, 'method': ['DELETE']}, |
|
794 | conditions={'function': check_repo, 'method': ['DELETE']}, | |
816 | requirements=URL_NAME_REQUIREMENTS) |
|
795 | requirements=URL_NAME_REQUIREMENTS) | |
817 |
|
796 | |||
818 | rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}', |
|
797 | rmap.connect('changeset_info', '/changeset_info/{repo_name}/{revision}', | |
819 | controller='changeset', action='changeset_info', |
|
798 | controller='changeset', action='changeset_info', | |
820 | requirements=URL_NAME_REQUIREMENTS) |
|
799 | requirements=URL_NAME_REQUIREMENTS) | |
821 |
|
800 | |||
822 | rmap.connect('compare_home', |
|
801 | rmap.connect('compare_home', | |
823 | '/{repo_name}/compare', |
|
802 | '/{repo_name}/compare', | |
824 | controller='compare', action='index', |
|
803 | controller='compare', action='index', | |
825 | conditions={'function': check_repo}, |
|
804 | conditions={'function': check_repo}, | |
826 | requirements=URL_NAME_REQUIREMENTS) |
|
805 | requirements=URL_NAME_REQUIREMENTS) | |
827 |
|
806 | |||
828 | rmap.connect('compare_url', |
|
807 | rmap.connect('compare_url', | |
829 | '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}', |
|
808 | '/{repo_name}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}', | |
830 | controller='compare', action='compare', |
|
809 | controller='compare', action='compare', | |
831 | conditions={'function': check_repo}, |
|
810 | conditions={'function': check_repo}, | |
832 | requirements=URL_NAME_REQUIREMENTS) |
|
811 | requirements=URL_NAME_REQUIREMENTS) | |
833 |
|
812 | |||
834 | rmap.connect('pullrequest_home', |
|
813 | rmap.connect('pullrequest_home', | |
835 | '/{repo_name}/pull-request/new', controller='pullrequests', |
|
814 | '/{repo_name}/pull-request/new', controller='pullrequests', | |
836 | action='index', conditions={'function': check_repo, |
|
815 | action='index', conditions={'function': check_repo, | |
837 | 'method': ['GET']}, |
|
816 | 'method': ['GET']}, | |
838 | requirements=URL_NAME_REQUIREMENTS) |
|
817 | requirements=URL_NAME_REQUIREMENTS) | |
839 |
|
818 | |||
840 | rmap.connect('pullrequest', |
|
819 | rmap.connect('pullrequest', | |
841 | '/{repo_name}/pull-request/new', controller='pullrequests', |
|
820 | '/{repo_name}/pull-request/new', controller='pullrequests', | |
842 | action='create', conditions={'function': check_repo, |
|
821 | action='create', conditions={'function': check_repo, | |
843 | 'method': ['POST']}, |
|
822 | 'method': ['POST']}, | |
844 | requirements=URL_NAME_REQUIREMENTS) |
|
823 | requirements=URL_NAME_REQUIREMENTS) | |
845 |
|
824 | |||
846 | rmap.connect('pullrequest_repo_refs', |
|
825 | rmap.connect('pullrequest_repo_refs', | |
847 | '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}', |
|
826 | '/{repo_name}/pull-request/refs/{target_repo_name:.*?[^/]}', | |
848 | controller='pullrequests', |
|
827 | controller='pullrequests', | |
849 | action='get_repo_refs', |
|
828 | action='get_repo_refs', | |
850 | conditions={'function': check_repo, 'method': ['GET']}, |
|
829 | conditions={'function': check_repo, 'method': ['GET']}, | |
851 | requirements=URL_NAME_REQUIREMENTS) |
|
830 | requirements=URL_NAME_REQUIREMENTS) | |
852 |
|
831 | |||
853 | rmap.connect('pullrequest_repo_destinations', |
|
832 | rmap.connect('pullrequest_repo_destinations', | |
854 | '/{repo_name}/pull-request/repo-destinations', |
|
833 | '/{repo_name}/pull-request/repo-destinations', | |
855 | controller='pullrequests', |
|
834 | controller='pullrequests', | |
856 | action='get_repo_destinations', |
|
835 | action='get_repo_destinations', | |
857 | conditions={'function': check_repo, 'method': ['GET']}, |
|
836 | conditions={'function': check_repo, 'method': ['GET']}, | |
858 | requirements=URL_NAME_REQUIREMENTS) |
|
837 | requirements=URL_NAME_REQUIREMENTS) | |
859 |
|
838 | |||
860 | rmap.connect('pullrequest_show', |
|
839 | rmap.connect('pullrequest_show', | |
861 | '/{repo_name}/pull-request/{pull_request_id}', |
|
840 | '/{repo_name}/pull-request/{pull_request_id}', | |
862 | controller='pullrequests', |
|
841 | controller='pullrequests', | |
863 | action='show', conditions={'function': check_repo, |
|
842 | action='show', conditions={'function': check_repo, | |
864 | 'method': ['GET']}, |
|
843 | 'method': ['GET']}, | |
865 | requirements=URL_NAME_REQUIREMENTS) |
|
844 | requirements=URL_NAME_REQUIREMENTS) | |
866 |
|
845 | |||
867 | rmap.connect('pullrequest_update', |
|
846 | rmap.connect('pullrequest_update', | |
868 | '/{repo_name}/pull-request/{pull_request_id}', |
|
847 | '/{repo_name}/pull-request/{pull_request_id}', | |
869 | controller='pullrequests', |
|
848 | controller='pullrequests', | |
870 | action='update', conditions={'function': check_repo, |
|
849 | action='update', conditions={'function': check_repo, | |
871 | 'method': ['PUT']}, |
|
850 | 'method': ['PUT']}, | |
872 | requirements=URL_NAME_REQUIREMENTS) |
|
851 | requirements=URL_NAME_REQUIREMENTS) | |
873 |
|
852 | |||
874 | rmap.connect('pullrequest_merge', |
|
853 | rmap.connect('pullrequest_merge', | |
875 | '/{repo_name}/pull-request/{pull_request_id}', |
|
854 | '/{repo_name}/pull-request/{pull_request_id}', | |
876 | controller='pullrequests', |
|
855 | controller='pullrequests', | |
877 | action='merge', conditions={'function': check_repo, |
|
856 | action='merge', conditions={'function': check_repo, | |
878 | 'method': ['POST']}, |
|
857 | 'method': ['POST']}, | |
879 | requirements=URL_NAME_REQUIREMENTS) |
|
858 | requirements=URL_NAME_REQUIREMENTS) | |
880 |
|
859 | |||
881 | rmap.connect('pullrequest_delete', |
|
860 | rmap.connect('pullrequest_delete', | |
882 | '/{repo_name}/pull-request/{pull_request_id}', |
|
861 | '/{repo_name}/pull-request/{pull_request_id}', | |
883 | controller='pullrequests', |
|
862 | controller='pullrequests', | |
884 | action='delete', conditions={'function': check_repo, |
|
863 | action='delete', conditions={'function': check_repo, | |
885 | 'method': ['DELETE']}, |
|
864 | 'method': ['DELETE']}, | |
886 | requirements=URL_NAME_REQUIREMENTS) |
|
865 | requirements=URL_NAME_REQUIREMENTS) | |
887 |
|
866 | |||
888 | rmap.connect('pullrequest_show_all', |
|
867 | rmap.connect('pullrequest_show_all', | |
889 | '/{repo_name}/pull-request', |
|
868 | '/{repo_name}/pull-request', | |
890 | controller='pullrequests', |
|
869 | controller='pullrequests', | |
891 | action='show_all', conditions={'function': check_repo, |
|
870 | action='show_all', conditions={'function': check_repo, | |
892 | 'method': ['GET']}, |
|
871 | 'method': ['GET']}, | |
893 | requirements=URL_NAME_REQUIREMENTS) |
|
872 | requirements=URL_NAME_REQUIREMENTS) | |
894 |
|
873 | |||
895 | rmap.connect('pullrequest_comment', |
|
874 | rmap.connect('pullrequest_comment', | |
896 | '/{repo_name}/pull-request-comment/{pull_request_id}', |
|
875 | '/{repo_name}/pull-request-comment/{pull_request_id}', | |
897 | controller='pullrequests', |
|
876 | controller='pullrequests', | |
898 | action='comment', conditions={'function': check_repo, |
|
877 | action='comment', conditions={'function': check_repo, | |
899 | 'method': ['POST']}, |
|
878 | 'method': ['POST']}, | |
900 | requirements=URL_NAME_REQUIREMENTS) |
|
879 | requirements=URL_NAME_REQUIREMENTS) | |
901 |
|
880 | |||
902 | rmap.connect('pullrequest_comment_delete', |
|
881 | rmap.connect('pullrequest_comment_delete', | |
903 | '/{repo_name}/pull-request-comment/{comment_id}/delete', |
|
882 | '/{repo_name}/pull-request-comment/{comment_id}/delete', | |
904 | controller='pullrequests', action='delete_comment', |
|
883 | controller='pullrequests', action='delete_comment', | |
905 | conditions={'function': check_repo, 'method': ['DELETE']}, |
|
884 | conditions={'function': check_repo, 'method': ['DELETE']}, | |
906 | requirements=URL_NAME_REQUIREMENTS) |
|
885 | requirements=URL_NAME_REQUIREMENTS) | |
907 |
|
886 | |||
908 | rmap.connect('summary_home_explicit', '/{repo_name}/summary', |
|
887 | rmap.connect('summary_home_explicit', '/{repo_name}/summary', | |
909 | controller='summary', conditions={'function': check_repo}, |
|
888 | controller='summary', conditions={'function': check_repo}, | |
910 | requirements=URL_NAME_REQUIREMENTS) |
|
889 | requirements=URL_NAME_REQUIREMENTS) | |
911 |
|
890 | |||
912 | rmap.connect('branches_home', '/{repo_name}/branches', |
|
891 | rmap.connect('branches_home', '/{repo_name}/branches', | |
913 | controller='branches', conditions={'function': check_repo}, |
|
892 | controller='branches', conditions={'function': check_repo}, | |
914 | requirements=URL_NAME_REQUIREMENTS) |
|
893 | requirements=URL_NAME_REQUIREMENTS) | |
915 |
|
894 | |||
916 | rmap.connect('tags_home', '/{repo_name}/tags', |
|
895 | rmap.connect('tags_home', '/{repo_name}/tags', | |
917 | controller='tags', conditions={'function': check_repo}, |
|
896 | controller='tags', conditions={'function': check_repo}, | |
918 | requirements=URL_NAME_REQUIREMENTS) |
|
897 | requirements=URL_NAME_REQUIREMENTS) | |
919 |
|
898 | |||
920 | rmap.connect('bookmarks_home', '/{repo_name}/bookmarks', |
|
899 | rmap.connect('bookmarks_home', '/{repo_name}/bookmarks', | |
921 | controller='bookmarks', conditions={'function': check_repo}, |
|
900 | controller='bookmarks', conditions={'function': check_repo}, | |
922 | requirements=URL_NAME_REQUIREMENTS) |
|
901 | requirements=URL_NAME_REQUIREMENTS) | |
923 |
|
902 | |||
924 | rmap.connect('changelog_home', '/{repo_name}/changelog', |
|
903 | rmap.connect('changelog_home', '/{repo_name}/changelog', | |
925 | controller='changelog', conditions={'function': check_repo}, |
|
904 | controller='changelog', conditions={'function': check_repo}, | |
926 | requirements=URL_NAME_REQUIREMENTS) |
|
905 | requirements=URL_NAME_REQUIREMENTS) | |
927 |
|
906 | |||
928 | rmap.connect('changelog_summary_home', '/{repo_name}/changelog_summary', |
|
907 | rmap.connect('changelog_summary_home', '/{repo_name}/changelog_summary', | |
929 | controller='changelog', action='changelog_summary', |
|
908 | controller='changelog', action='changelog_summary', | |
930 | conditions={'function': check_repo}, |
|
909 | conditions={'function': check_repo}, | |
931 | requirements=URL_NAME_REQUIREMENTS) |
|
910 | requirements=URL_NAME_REQUIREMENTS) | |
932 |
|
911 | |||
933 | rmap.connect('changelog_file_home', '/{repo_name}/changelog/{revision}/{f_path}', |
|
912 | rmap.connect('changelog_file_home', '/{repo_name}/changelog/{revision}/{f_path}', | |
934 | controller='changelog', f_path=None, |
|
913 | controller='changelog', f_path=None, | |
935 | conditions={'function': check_repo}, |
|
914 | conditions={'function': check_repo}, | |
936 | requirements=URL_NAME_REQUIREMENTS) |
|
915 | requirements=URL_NAME_REQUIREMENTS) | |
937 |
|
916 | |||
938 | rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}', |
|
917 | rmap.connect('changelog_details', '/{repo_name}/changelog_details/{cs}', | |
939 | controller='changelog', action='changelog_details', |
|
918 | controller='changelog', action='changelog_details', | |
940 | conditions={'function': check_repo}, |
|
919 | conditions={'function': check_repo}, | |
941 | requirements=URL_NAME_REQUIREMENTS) |
|
920 | requirements=URL_NAME_REQUIREMENTS) | |
942 |
|
921 | |||
943 | rmap.connect('files_home', |
|
922 | rmap.connect('files_home', | |
944 | '/{repo_name}/files/{revision}/{f_path}', |
|
923 | '/{repo_name}/files/{revision}/{f_path}', | |
945 | controller='files', revision='tip', f_path='', |
|
924 | controller='files', revision='tip', f_path='', | |
946 | conditions={'function': check_repo}, |
|
925 | conditions={'function': check_repo}, | |
947 | requirements=URL_NAME_REQUIREMENTS) |
|
926 | requirements=URL_NAME_REQUIREMENTS) | |
948 |
|
927 | |||
949 | rmap.connect('files_home_simple_catchrev', |
|
928 | rmap.connect('files_home_simple_catchrev', | |
950 | '/{repo_name}/files/{revision}', |
|
929 | '/{repo_name}/files/{revision}', | |
951 | controller='files', revision='tip', f_path='', |
|
930 | controller='files', revision='tip', f_path='', | |
952 | conditions={'function': check_repo}, |
|
931 | conditions={'function': check_repo}, | |
953 | requirements=URL_NAME_REQUIREMENTS) |
|
932 | requirements=URL_NAME_REQUIREMENTS) | |
954 |
|
933 | |||
955 | rmap.connect('files_home_simple_catchall', |
|
934 | rmap.connect('files_home_simple_catchall', | |
956 | '/{repo_name}/files', |
|
935 | '/{repo_name}/files', | |
957 | controller='files', revision='tip', f_path='', |
|
936 | controller='files', revision='tip', f_path='', | |
958 | conditions={'function': check_repo}, |
|
937 | conditions={'function': check_repo}, | |
959 | requirements=URL_NAME_REQUIREMENTS) |
|
938 | requirements=URL_NAME_REQUIREMENTS) | |
960 |
|
939 | |||
961 | rmap.connect('files_history_home', |
|
940 | rmap.connect('files_history_home', | |
962 | '/{repo_name}/history/{revision}/{f_path}', |
|
941 | '/{repo_name}/history/{revision}/{f_path}', | |
963 | controller='files', action='history', revision='tip', f_path='', |
|
942 | controller='files', action='history', revision='tip', f_path='', | |
964 | conditions={'function': check_repo}, |
|
943 | conditions={'function': check_repo}, | |
965 | requirements=URL_NAME_REQUIREMENTS) |
|
944 | requirements=URL_NAME_REQUIREMENTS) | |
966 |
|
945 | |||
967 | rmap.connect('files_authors_home', |
|
946 | rmap.connect('files_authors_home', | |
968 | '/{repo_name}/authors/{revision}/{f_path}', |
|
947 | '/{repo_name}/authors/{revision}/{f_path}', | |
969 | controller='files', action='authors', revision='tip', f_path='', |
|
948 | controller='files', action='authors', revision='tip', f_path='', | |
970 | conditions={'function': check_repo}, |
|
949 | conditions={'function': check_repo}, | |
971 | requirements=URL_NAME_REQUIREMENTS) |
|
950 | requirements=URL_NAME_REQUIREMENTS) | |
972 |
|
951 | |||
973 | rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}', |
|
952 | rmap.connect('files_diff_home', '/{repo_name}/diff/{f_path}', | |
974 | controller='files', action='diff', f_path='', |
|
953 | controller='files', action='diff', f_path='', | |
975 | conditions={'function': check_repo}, |
|
954 | conditions={'function': check_repo}, | |
976 | requirements=URL_NAME_REQUIREMENTS) |
|
955 | requirements=URL_NAME_REQUIREMENTS) | |
977 |
|
956 | |||
978 | rmap.connect('files_diff_2way_home', |
|
957 | rmap.connect('files_diff_2way_home', | |
979 | '/{repo_name}/diff-2way/{f_path}', |
|
958 | '/{repo_name}/diff-2way/{f_path}', | |
980 | controller='files', action='diff_2way', f_path='', |
|
959 | controller='files', action='diff_2way', f_path='', | |
981 | conditions={'function': check_repo}, |
|
960 | conditions={'function': check_repo}, | |
982 | requirements=URL_NAME_REQUIREMENTS) |
|
961 | requirements=URL_NAME_REQUIREMENTS) | |
983 |
|
962 | |||
984 | rmap.connect('files_rawfile_home', |
|
963 | rmap.connect('files_rawfile_home', | |
985 | '/{repo_name}/rawfile/{revision}/{f_path}', |
|
964 | '/{repo_name}/rawfile/{revision}/{f_path}', | |
986 | controller='files', action='rawfile', revision='tip', |
|
965 | controller='files', action='rawfile', revision='tip', | |
987 | f_path='', conditions={'function': check_repo}, |
|
966 | f_path='', conditions={'function': check_repo}, | |
988 | requirements=URL_NAME_REQUIREMENTS) |
|
967 | requirements=URL_NAME_REQUIREMENTS) | |
989 |
|
968 | |||
990 | rmap.connect('files_raw_home', |
|
969 | rmap.connect('files_raw_home', | |
991 | '/{repo_name}/raw/{revision}/{f_path}', |
|
970 | '/{repo_name}/raw/{revision}/{f_path}', | |
992 | controller='files', action='raw', revision='tip', f_path='', |
|
971 | controller='files', action='raw', revision='tip', f_path='', | |
993 | conditions={'function': check_repo}, |
|
972 | conditions={'function': check_repo}, | |
994 | requirements=URL_NAME_REQUIREMENTS) |
|
973 | requirements=URL_NAME_REQUIREMENTS) | |
995 |
|
974 | |||
996 | rmap.connect('files_render_home', |
|
975 | rmap.connect('files_render_home', | |
997 | '/{repo_name}/render/{revision}/{f_path}', |
|
976 | '/{repo_name}/render/{revision}/{f_path}', | |
998 | controller='files', action='index', revision='tip', f_path='', |
|
977 | controller='files', action='index', revision='tip', f_path='', | |
999 | rendered=True, conditions={'function': check_repo}, |
|
978 | rendered=True, conditions={'function': check_repo}, | |
1000 | requirements=URL_NAME_REQUIREMENTS) |
|
979 | requirements=URL_NAME_REQUIREMENTS) | |
1001 |
|
980 | |||
1002 | rmap.connect('files_annotate_home', |
|
981 | rmap.connect('files_annotate_home', | |
1003 | '/{repo_name}/annotate/{revision}/{f_path}', |
|
982 | '/{repo_name}/annotate/{revision}/{f_path}', | |
1004 | controller='files', action='index', revision='tip', |
|
983 | controller='files', action='index', revision='tip', | |
1005 | f_path='', annotate=True, conditions={'function': check_repo}, |
|
984 | f_path='', annotate=True, conditions={'function': check_repo}, | |
1006 | requirements=URL_NAME_REQUIREMENTS) |
|
985 | requirements=URL_NAME_REQUIREMENTS) | |
1007 |
|
986 | |||
1008 | rmap.connect('files_edit', |
|
987 | rmap.connect('files_edit', | |
1009 | '/{repo_name}/edit/{revision}/{f_path}', |
|
988 | '/{repo_name}/edit/{revision}/{f_path}', | |
1010 | controller='files', action='edit', revision='tip', |
|
989 | controller='files', action='edit', revision='tip', | |
1011 | f_path='', |
|
990 | f_path='', | |
1012 | conditions={'function': check_repo, 'method': ['POST']}, |
|
991 | conditions={'function': check_repo, 'method': ['POST']}, | |
1013 | requirements=URL_NAME_REQUIREMENTS) |
|
992 | requirements=URL_NAME_REQUIREMENTS) | |
1014 |
|
993 | |||
1015 | rmap.connect('files_edit_home', |
|
994 | rmap.connect('files_edit_home', | |
1016 | '/{repo_name}/edit/{revision}/{f_path}', |
|
995 | '/{repo_name}/edit/{revision}/{f_path}', | |
1017 | controller='files', action='edit_home', revision='tip', |
|
996 | controller='files', action='edit_home', revision='tip', | |
1018 | f_path='', conditions={'function': check_repo}, |
|
997 | f_path='', conditions={'function': check_repo}, | |
1019 | requirements=URL_NAME_REQUIREMENTS) |
|
998 | requirements=URL_NAME_REQUIREMENTS) | |
1020 |
|
999 | |||
1021 | rmap.connect('files_add', |
|
1000 | rmap.connect('files_add', | |
1022 | '/{repo_name}/add/{revision}/{f_path}', |
|
1001 | '/{repo_name}/add/{revision}/{f_path}', | |
1023 | controller='files', action='add', revision='tip', |
|
1002 | controller='files', action='add', revision='tip', | |
1024 | f_path='', |
|
1003 | f_path='', | |
1025 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1004 | conditions={'function': check_repo, 'method': ['POST']}, | |
1026 | requirements=URL_NAME_REQUIREMENTS) |
|
1005 | requirements=URL_NAME_REQUIREMENTS) | |
1027 |
|
1006 | |||
1028 | rmap.connect('files_add_home', |
|
1007 | rmap.connect('files_add_home', | |
1029 | '/{repo_name}/add/{revision}/{f_path}', |
|
1008 | '/{repo_name}/add/{revision}/{f_path}', | |
1030 | controller='files', action='add_home', revision='tip', |
|
1009 | controller='files', action='add_home', revision='tip', | |
1031 | f_path='', conditions={'function': check_repo}, |
|
1010 | f_path='', conditions={'function': check_repo}, | |
1032 | requirements=URL_NAME_REQUIREMENTS) |
|
1011 | requirements=URL_NAME_REQUIREMENTS) | |
1033 |
|
1012 | |||
1034 | rmap.connect('files_delete', |
|
1013 | rmap.connect('files_delete', | |
1035 | '/{repo_name}/delete/{revision}/{f_path}', |
|
1014 | '/{repo_name}/delete/{revision}/{f_path}', | |
1036 | controller='files', action='delete', revision='tip', |
|
1015 | controller='files', action='delete', revision='tip', | |
1037 | f_path='', |
|
1016 | f_path='', | |
1038 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1017 | conditions={'function': check_repo, 'method': ['POST']}, | |
1039 | requirements=URL_NAME_REQUIREMENTS) |
|
1018 | requirements=URL_NAME_REQUIREMENTS) | |
1040 |
|
1019 | |||
1041 | rmap.connect('files_delete_home', |
|
1020 | rmap.connect('files_delete_home', | |
1042 | '/{repo_name}/delete/{revision}/{f_path}', |
|
1021 | '/{repo_name}/delete/{revision}/{f_path}', | |
1043 | controller='files', action='delete_home', revision='tip', |
|
1022 | controller='files', action='delete_home', revision='tip', | |
1044 | f_path='', conditions={'function': check_repo}, |
|
1023 | f_path='', conditions={'function': check_repo}, | |
1045 | requirements=URL_NAME_REQUIREMENTS) |
|
1024 | requirements=URL_NAME_REQUIREMENTS) | |
1046 |
|
1025 | |||
1047 | rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}', |
|
1026 | rmap.connect('files_archive_home', '/{repo_name}/archive/{fname}', | |
1048 | controller='files', action='archivefile', |
|
1027 | controller='files', action='archivefile', | |
1049 | conditions={'function': check_repo}, |
|
1028 | conditions={'function': check_repo}, | |
1050 | requirements=URL_NAME_REQUIREMENTS) |
|
1029 | requirements=URL_NAME_REQUIREMENTS) | |
1051 |
|
1030 | |||
1052 | rmap.connect('files_nodelist_home', |
|
1031 | rmap.connect('files_nodelist_home', | |
1053 | '/{repo_name}/nodelist/{revision}/{f_path}', |
|
1032 | '/{repo_name}/nodelist/{revision}/{f_path}', | |
1054 | controller='files', action='nodelist', |
|
1033 | controller='files', action='nodelist', | |
1055 | conditions={'function': check_repo}, |
|
1034 | conditions={'function': check_repo}, | |
1056 | requirements=URL_NAME_REQUIREMENTS) |
|
1035 | requirements=URL_NAME_REQUIREMENTS) | |
1057 |
|
1036 | |||
1058 | rmap.connect('files_metadata_list_home', |
|
1037 | rmap.connect('files_metadata_list_home', | |
1059 | '/{repo_name}/metadata_list/{revision}/{f_path}', |
|
1038 | '/{repo_name}/metadata_list/{revision}/{f_path}', | |
1060 | controller='files', action='metadata_list', |
|
1039 | controller='files', action='metadata_list', | |
1061 | conditions={'function': check_repo}, |
|
1040 | conditions={'function': check_repo}, | |
1062 | requirements=URL_NAME_REQUIREMENTS) |
|
1041 | requirements=URL_NAME_REQUIREMENTS) | |
1063 |
|
1042 | |||
1064 | rmap.connect('repo_fork_create_home', '/{repo_name}/fork', |
|
1043 | rmap.connect('repo_fork_create_home', '/{repo_name}/fork', | |
1065 | controller='forks', action='fork_create', |
|
1044 | controller='forks', action='fork_create', | |
1066 | conditions={'function': check_repo, 'method': ['POST']}, |
|
1045 | conditions={'function': check_repo, 'method': ['POST']}, | |
1067 | requirements=URL_NAME_REQUIREMENTS) |
|
1046 | requirements=URL_NAME_REQUIREMENTS) | |
1068 |
|
1047 | |||
1069 | rmap.connect('repo_fork_home', '/{repo_name}/fork', |
|
1048 | rmap.connect('repo_fork_home', '/{repo_name}/fork', | |
1070 | controller='forks', action='fork', |
|
1049 | controller='forks', action='fork', | |
1071 | conditions={'function': check_repo}, |
|
1050 | conditions={'function': check_repo}, | |
1072 | requirements=URL_NAME_REQUIREMENTS) |
|
1051 | requirements=URL_NAME_REQUIREMENTS) | |
1073 |
|
1052 | |||
1074 | rmap.connect('repo_forks_home', '/{repo_name}/forks', |
|
1053 | rmap.connect('repo_forks_home', '/{repo_name}/forks', | |
1075 | controller='forks', action='forks', |
|
1054 | controller='forks', action='forks', | |
1076 | conditions={'function': check_repo}, |
|
1055 | conditions={'function': check_repo}, | |
1077 | requirements=URL_NAME_REQUIREMENTS) |
|
1056 | requirements=URL_NAME_REQUIREMENTS) | |
1078 |
|
1057 | |||
1079 | rmap.connect('repo_followers_home', '/{repo_name}/followers', |
|
1058 | rmap.connect('repo_followers_home', '/{repo_name}/followers', | |
1080 | controller='followers', action='followers', |
|
1059 | controller='followers', action='followers', | |
1081 | conditions={'function': check_repo}, |
|
1060 | conditions={'function': check_repo}, | |
1082 | requirements=URL_NAME_REQUIREMENTS) |
|
1061 | requirements=URL_NAME_REQUIREMENTS) | |
1083 |
|
1062 | |||
1084 | # must be here for proper group/repo catching pattern |
|
1063 | # must be here for proper group/repo catching pattern | |
1085 | _connect_with_slash( |
|
1064 | _connect_with_slash( | |
1086 | rmap, 'repo_group_home', '/{group_name}', |
|
1065 | rmap, 'repo_group_home', '/{group_name}', | |
1087 | controller='home', action='index_repo_group', |
|
1066 | controller='home', action='index_repo_group', | |
1088 | conditions={'function': check_group}, |
|
1067 | conditions={'function': check_group}, | |
1089 | requirements=URL_NAME_REQUIREMENTS) |
|
1068 | requirements=URL_NAME_REQUIREMENTS) | |
1090 |
|
1069 | |||
1091 | # catch all, at the end |
|
1070 | # catch all, at the end | |
1092 | _connect_with_slash( |
|
1071 | _connect_with_slash( | |
1093 | rmap, 'summary_home', '/{repo_name}', |
|
1072 | rmap, 'summary_home', '/{repo_name}', | |
1094 | controller='summary', action='index', |
|
1073 | controller='summary', action='index', | |
1095 | conditions={'function': check_repo}, |
|
1074 | conditions={'function': check_repo}, | |
1096 | requirements=URL_NAME_REQUIREMENTS) |
|
1075 | requirements=URL_NAME_REQUIREMENTS) | |
1097 |
|
1076 | |||
1098 | return rmap |
|
1077 | return rmap | |
1099 |
|
1078 | |||
1100 |
|
1079 | |||
1101 | def _connect_with_slash(mapper, name, path, *args, **kwargs): |
|
1080 | def _connect_with_slash(mapper, name, path, *args, **kwargs): | |
1102 | """ |
|
1081 | """ | |
1103 | Connect a route with an optional trailing slash in `path`. |
|
1082 | Connect a route with an optional trailing slash in `path`. | |
1104 | """ |
|
1083 | """ | |
1105 | mapper.connect(name + '_slash', path + '/', *args, **kwargs) |
|
1084 | mapper.connect(name + '_slash', path + '/', *args, **kwargs) | |
1106 | mapper.connect(name, path, *args, **kwargs) |
|
1085 | mapper.connect(name, path, *args, **kwargs) |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now