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