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