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