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