Show More
@@ -1,86 +1,86 b'' | |||
|
1 | 1 | """Pylons environment configuration""" |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | import logging |
|
5 | 5 | |
|
6 | 6 | from mako.lookup import TemplateLookup |
|
7 | 7 | from pylons.configuration import PylonsConfig |
|
8 | 8 | from pylons.error import handle_mako_error |
|
9 | from sqlalchemy import engine_from_config | |
|
9 | 10 | |
|
10 | 11 | import rhodecode.lib.app_globals as app_globals |
|
11 | 12 | import rhodecode.lib.helpers |
|
12 | 13 | |
|
13 | 14 | from rhodecode.config.routing import make_map |
|
14 | 15 | from rhodecode.lib import celerypylons |
|
15 | 16 | from rhodecode.lib.auth import set_available_permissions, set_base_path |
|
16 | 17 | from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config |
|
17 | 18 | from rhodecode.model import init_model |
|
18 | 19 | from rhodecode.model.scm import ScmModel |
|
19 | from sqlalchemy import engine_from_config | |
|
20 | from rhodecode.lib.timerproxy import TimerProxy | |
|
20 | 21 | |
|
21 | 22 | log = logging.getLogger(__name__) |
|
22 | 23 | |
|
23 | 24 | def load_environment(global_conf, app_conf, initial=False): |
|
24 | 25 | """Configure the Pylons environment via the ``pylons.config`` |
|
25 | 26 | object |
|
26 | 27 | """ |
|
27 | 28 | config = PylonsConfig() |
|
28 | 29 | |
|
29 | 30 | # Pylons paths |
|
30 | 31 | root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
|
31 | 32 | paths = dict(root=root, |
|
32 | 33 | controllers=os.path.join(root, 'controllers'), |
|
33 | 34 | static_files=os.path.join(root, 'public'), |
|
34 | 35 | templates=[os.path.join(root, 'templates')]) |
|
35 | 36 | |
|
36 | 37 | # Initialize config with the basic options |
|
37 | 38 | config.init_app(global_conf, app_conf, package='rhodecode', paths=paths) |
|
38 | 39 | |
|
39 | 40 | config['routes.map'] = make_map(config) |
|
40 | 41 | config['pylons.app_globals'] = app_globals.Globals(config) |
|
41 | 42 | config['pylons.h'] = rhodecode.lib.helpers |
|
42 | 43 | |
|
43 | 44 | # Setup cache object as early as possible |
|
44 | 45 | import pylons |
|
45 | 46 | pylons.cache._push_object(config['pylons.app_globals'].cache) |
|
46 | 47 | |
|
47 | 48 | # Create the Mako TemplateLookup, with the default auto-escaping |
|
48 | 49 | config['pylons.app_globals'].mako_lookup = TemplateLookup( |
|
49 | 50 | directories=paths['templates'], |
|
50 | 51 | error_handler=handle_mako_error, |
|
51 | 52 | module_directory=os.path.join(app_conf['cache_dir'], 'templates'), |
|
52 | 53 | input_encoding='utf-8', default_filters=['escape'], |
|
53 | 54 | imports=['from webhelpers.html import escape']) |
|
54 | 55 | |
|
55 | 56 | #sets the c attribute access when don't existing attribute are accessed |
|
56 | 57 | config['pylons.strict_tmpl_context'] = True |
|
57 | 58 | test = os.path.split(config['__file__'])[-1] == 'test.ini' |
|
58 | 59 | if test: |
|
59 | 60 | from rhodecode.lib.utils import create_test_env, create_test_index |
|
60 | 61 | from rhodecode.tests import TESTS_TMP_PATH |
|
61 | 62 | create_test_env(TESTS_TMP_PATH, config) |
|
62 | 63 | create_test_index(TESTS_TMP_PATH, True) |
|
63 | 64 | |
|
64 | 65 | #MULTIPLE DB configs |
|
65 | 66 | # Setup the SQLAlchemy database engine |
|
66 | 67 | if config['debug'] and not test: |
|
67 | 68 | #use query time debugging. |
|
68 | from rhodecode.lib.timerproxy import TimerProxy | |
|
69 | 69 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.', |
|
70 | 70 | proxy=TimerProxy()) |
|
71 | 71 | else: |
|
72 | 72 | sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.') |
|
73 | 73 | |
|
74 | 74 | init_model(sa_engine_db1) |
|
75 | 75 | #init baseui |
|
76 | 76 | config['pylons.app_globals'].baseui = make_ui('db') |
|
77 | 77 | |
|
78 | 78 | g = config['pylons.app_globals'] |
|
79 | 79 | repo2db_mapper(ScmModel().repo_scan(g.paths[0][1], g.baseui)) |
|
80 | 80 | set_available_permissions(config) |
|
81 | 81 | set_base_path(config) |
|
82 | 82 | set_rhodecode_config(config) |
|
83 | 83 | # CONFIGURATION OPTIONS HERE (note: all config options will override |
|
84 | 84 | # any Pylons config options) |
|
85 | 85 | |
|
86 | 86 | return config |
@@ -1,76 +1,79 b'' | |||
|
1 | 1 | """Pylons middleware initialization""" |
|
2 | ||
|
2 | 3 | from beaker.middleware import SessionMiddleware |
|
4 | from routes.middleware import RoutesMiddleware | |
|
3 | 5 | from paste.cascade import Cascade |
|
4 | 6 | from paste.registry import RegistryManager |
|
5 | 7 | from paste.urlparser import StaticURLParser |
|
6 | 8 | from paste.deploy.converters import asbool |
|
9 | from paste.gzipper import make_gzip_middleware | |
|
10 | ||
|
7 | 11 | from pylons.middleware import ErrorHandler, StatusCodeRedirect |
|
8 | 12 | from pylons.wsgiapp import PylonsApp |
|
9 | from routes.middleware import RoutesMiddleware | |
|
13 | ||
|
10 | 14 | from rhodecode.lib.middleware.simplehg import SimpleHg |
|
11 | 15 | from rhodecode.lib.middleware.simplegit import SimpleGit |
|
12 | 16 | from rhodecode.lib.middleware.https_fixup import HttpsFixup |
|
13 | 17 | from rhodecode.config.environment import load_environment |
|
14 | from paste.gzipper import make_gzip_middleware | |
|
15 | 18 | |
|
16 | 19 | def make_app(global_conf, full_stack=True, static_files=True, **app_conf): |
|
17 | 20 | """Create a Pylons WSGI application and return it |
|
18 | 21 | |
|
19 | 22 | ``global_conf`` |
|
20 | 23 | The inherited configuration for this application. Normally from |
|
21 | 24 | the [DEFAULT] section of the Paste ini file. |
|
22 | 25 | |
|
23 | 26 | ``full_stack`` |
|
24 | 27 | Whether or not this application provides a full WSGI stack (by |
|
25 | 28 | default, meaning it handles its own exceptions and errors). |
|
26 | 29 | Disable full_stack when this application is "managed" by |
|
27 | 30 | another WSGI middleware. |
|
28 | 31 | |
|
29 | 32 | ``app_conf`` |
|
30 | 33 | The application's local configuration. Normally specified in |
|
31 | 34 | the [app:<name>] section of the Paste ini file (where <name> |
|
32 | 35 | defaults to main). |
|
33 | 36 | |
|
34 | 37 | """ |
|
35 | 38 | # Configure the Pylons environment |
|
36 | 39 | config = load_environment(global_conf, app_conf) |
|
37 | 40 | |
|
38 | 41 | # The Pylons WSGI app |
|
39 | 42 | app = PylonsApp(config=config) |
|
40 | 43 | |
|
41 | 44 | # Routing/Session/Cache Middleware |
|
42 | 45 | app = RoutesMiddleware(app, config['routes.map']) |
|
43 | 46 | app = SessionMiddleware(app, config) |
|
44 | 47 | |
|
45 | 48 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
|
46 | 49 | |
|
47 | 50 | app = SimpleHg(app, config) |
|
48 | 51 | app = SimpleGit(app, config) |
|
49 | 52 | |
|
50 | 53 | if asbool(full_stack): |
|
51 | 54 | # Handle Python exceptions |
|
52 | 55 | app = ErrorHandler(app, global_conf, **config['pylons.errorware']) |
|
53 | 56 | |
|
54 | 57 | # Display error documents for 401, 403, 404 status codes (and |
|
55 | 58 | # 500 when debug is disabled) |
|
56 | 59 | if asbool(config['debug']): |
|
57 | 60 | app = StatusCodeRedirect(app) |
|
58 | 61 | else: |
|
59 | 62 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) |
|
60 | 63 | |
|
61 | 64 | #enable https redirets based on HTTP_X_URL_SCHEME set by proxy |
|
62 | 65 | app = HttpsFixup(app, config) |
|
63 | 66 | |
|
64 | 67 | # Establish the Registry for this application |
|
65 | 68 | app = RegistryManager(app) |
|
66 | 69 | |
|
67 | 70 | if asbool(static_files): |
|
68 | 71 | # Serve static files |
|
69 | 72 | static_app = StaticURLParser(config['pylons.paths']['static_files']) |
|
70 | 73 | app = Cascade([static_app, app]) |
|
71 | 74 | app = make_gzip_middleware(app, global_conf, compress_level=1) |
|
72 | 75 | |
|
73 | 76 | app.config = config |
|
74 | 77 | |
|
75 | 78 | return app |
|
76 | 79 |
@@ -1,224 +1,225 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Routes configuration |
|
3 | 3 | |
|
4 | 4 | The more specific and detailed routes should be defined first so they |
|
5 | 5 | may take precedent over the more generic routes. For more information |
|
6 | 6 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
7 | 7 | """ |
|
8 | 8 | from __future__ import with_statement |
|
9 | 9 | from routes import Mapper |
|
10 | 10 | from rhodecode.lib.utils import check_repo_fast as cr |
|
11 | 11 | |
|
12 | 12 | def make_map(config): |
|
13 | 13 | """Create, configure and return the routes Mapper""" |
|
14 | map = Mapper(directory=config['pylons.paths']['controllers'], | |
|
14 | routes_map = Mapper(directory=config['pylons.paths']['controllers'], | |
|
15 | 15 | always_scan=config['debug']) |
|
16 | map.minimization = False | |
|
17 | map.explicit = False | |
|
16 | routes_map.minimization = False | |
|
17 | routes_map.explicit = False | |
|
18 | 18 | |
|
19 | 19 | def check_repo(environ, match_dict): |
|
20 | 20 | """ |
|
21 | 21 | check for valid repository for proper 404 handling |
|
22 | ||
|
22 | 23 | :param environ: |
|
23 | 24 | :param match_dict: |
|
24 | 25 | """ |
|
25 | 26 | repo_name = match_dict.get('repo_name') |
|
26 | 27 | return not cr(repo_name, config['base_path']) |
|
27 | 28 | |
|
28 | 29 | # The ErrorController route (handles 404/500 error pages); it should |
|
29 | 30 | # likely stay at the top, ensuring it can always be resolved |
|
30 | map.connect('/error/{action}', controller='error') | |
|
31 | map.connect('/error/{action}/{id}', controller='error') | |
|
31 | routes_map.connect('/error/{action}', controller='error') | |
|
32 | routes_map.connect('/error/{action}/{id}', controller='error') | |
|
32 | 33 | |
|
33 | 34 | #========================================================================== |
|
34 | 35 | # CUSTOM ROUTES HERE |
|
35 | 36 | #========================================================================== |
|
36 | 37 | |
|
37 | 38 | #MAIN PAGE |
|
38 | map.connect('home', '/', controller='home', action='index') | |
|
39 | map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True) | |
|
40 | map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True) | |
|
39 | routes_map.connect('home', '/', controller='home', action='index') | |
|
40 | routes_map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True) | |
|
41 | routes_map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True) | |
|
41 | 42 | #ADMIN REPOSITORY REST ROUTES |
|
42 | with map.submapper(path_prefix='/_admin', controller='admin/repos') as m: | |
|
43 | with routes_map.submapper(path_prefix='/_admin', controller='admin/repos') as m: | |
|
43 | 44 | m.connect("repos", "/repos", |
|
44 | 45 | action="create", conditions=dict(method=["POST"])) |
|
45 | 46 | m.connect("repos", "/repos", |
|
46 | 47 | action="index", conditions=dict(method=["GET"])) |
|
47 | 48 | m.connect("formatted_repos", "/repos.{format}", |
|
48 | 49 | action="index", |
|
49 | 50 | conditions=dict(method=["GET"])) |
|
50 | 51 | m.connect("new_repo", "/repos/new", |
|
51 | 52 | action="new", conditions=dict(method=["GET"])) |
|
52 | 53 | m.connect("formatted_new_repo", "/repos/new.{format}", |
|
53 | 54 | action="new", conditions=dict(method=["GET"])) |
|
54 | 55 | m.connect("/repos/{repo_name:.*}", |
|
55 | 56 | action="update", conditions=dict(method=["PUT"], |
|
56 | 57 | function=check_repo)) |
|
57 | 58 | m.connect("/repos/{repo_name:.*}", |
|
58 | 59 | action="delete", conditions=dict(method=["DELETE"], |
|
59 | 60 | function=check_repo)) |
|
60 | 61 | m.connect("edit_repo", "/repos/{repo_name:.*}/edit", |
|
61 | 62 | action="edit", conditions=dict(method=["GET"], |
|
62 | 63 | function=check_repo)) |
|
63 | 64 | m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit", |
|
64 | 65 | action="edit", conditions=dict(method=["GET"], |
|
65 | 66 | function=check_repo)) |
|
66 | 67 | m.connect("repo", "/repos/{repo_name:.*}", |
|
67 | 68 | action="show", conditions=dict(method=["GET"], |
|
68 | 69 | function=check_repo)) |
|
69 | 70 | m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}", |
|
70 | 71 | action="show", conditions=dict(method=["GET"], |
|
71 | 72 | function=check_repo)) |
|
72 | 73 | #ajax delete repo perm user |
|
73 | 74 | m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}", |
|
74 | 75 | action="delete_perm_user", conditions=dict(method=["DELETE"], |
|
75 | 76 | function=check_repo)) |
|
76 | 77 | #ajax delete repo perm users_group |
|
77 | 78 | m.connect('delete_repo_users_group', "/repos_delete_users_group/{repo_name:.*}", |
|
78 | 79 | action="delete_perm_users_group", conditions=dict(method=["DELETE"], |
|
79 | 80 | function=check_repo)) |
|
80 | 81 | |
|
81 | 82 | #settings actions |
|
82 | 83 | m.connect('repo_stats', "/repos_stats/{repo_name:.*}", |
|
83 | 84 | action="repo_stats", conditions=dict(method=["DELETE"], |
|
84 | 85 | function=check_repo)) |
|
85 | 86 | m.connect('repo_cache', "/repos_cache/{repo_name:.*}", |
|
86 | 87 | action="repo_cache", conditions=dict(method=["DELETE"], |
|
87 | 88 | function=check_repo)) |
|
88 | 89 | |
|
89 | 90 | #ADMIN USER REST ROUTES |
|
90 | map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') | |
|
91 | routes_map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') | |
|
91 | 92 | |
|
92 | 93 | #ADMIN USER REST ROUTES |
|
93 | map.resource('users_group', 'users_groups', controller='admin/users_groups', path_prefix='/_admin') | |
|
94 | routes_map.resource('users_group', 'users_groups', controller='admin/users_groups', path_prefix='/_admin') | |
|
94 | 95 | |
|
95 | 96 | #ADMIN GROUP REST ROUTES |
|
96 | map.resource('group', 'groups', controller='admin/groups', path_prefix='/_admin') | |
|
97 | routes_map.resource('group', 'groups', controller='admin/groups', path_prefix='/_admin') | |
|
97 | 98 | |
|
98 | 99 | #ADMIN PERMISSIONS REST ROUTES |
|
99 | map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') | |
|
100 | routes_map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') | |
|
100 | 101 | |
|
101 | 102 | ##ADMIN LDAP SETTINGS |
|
102 | map.connect('ldap_settings', '/_admin/ldap', controller='admin/ldap_settings', | |
|
103 | routes_map.connect('ldap_settings', '/_admin/ldap', controller='admin/ldap_settings', | |
|
103 | 104 | action='ldap_settings', conditions=dict(method=["POST"])) |
|
104 | map.connect('ldap_home', '/_admin/ldap', controller='admin/ldap_settings',) | |
|
105 | routes_map.connect('ldap_home', '/_admin/ldap', controller='admin/ldap_settings',) | |
|
105 | 106 | |
|
106 | 107 | |
|
107 | 108 | #ADMIN SETTINGS REST ROUTES |
|
108 | with map.submapper(path_prefix='/_admin', controller='admin/settings') as m: | |
|
109 | with routes_map.submapper(path_prefix='/_admin', controller='admin/settings') as m: | |
|
109 | 110 | m.connect("admin_settings", "/settings", |
|
110 | 111 | action="create", conditions=dict(method=["POST"])) |
|
111 | 112 | m.connect("admin_settings", "/settings", |
|
112 | 113 | action="index", conditions=dict(method=["GET"])) |
|
113 | 114 | m.connect("formatted_admin_settings", "/settings.{format}", |
|
114 | 115 | action="index", conditions=dict(method=["GET"])) |
|
115 | 116 | m.connect("admin_new_setting", "/settings/new", |
|
116 | 117 | action="new", conditions=dict(method=["GET"])) |
|
117 | 118 | m.connect("formatted_admin_new_setting", "/settings/new.{format}", |
|
118 | 119 | action="new", conditions=dict(method=["GET"])) |
|
119 | 120 | m.connect("/settings/{setting_id}", |
|
120 | 121 | action="update", conditions=dict(method=["PUT"])) |
|
121 | 122 | m.connect("/settings/{setting_id}", |
|
122 | 123 | action="delete", conditions=dict(method=["DELETE"])) |
|
123 | 124 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", |
|
124 | 125 | action="edit", conditions=dict(method=["GET"])) |
|
125 | 126 | m.connect("formatted_admin_edit_setting", "/settings/{setting_id}.{format}/edit", |
|
126 | 127 | action="edit", conditions=dict(method=["GET"])) |
|
127 | 128 | m.connect("admin_setting", "/settings/{setting_id}", |
|
128 | 129 | action="show", conditions=dict(method=["GET"])) |
|
129 | 130 | m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}", |
|
130 | 131 | action="show", conditions=dict(method=["GET"])) |
|
131 | 132 | m.connect("admin_settings_my_account", "/my_account", |
|
132 | 133 | action="my_account", conditions=dict(method=["GET"])) |
|
133 | 134 | m.connect("admin_settings_my_account_update", "/my_account_update", |
|
134 | 135 | action="my_account_update", conditions=dict(method=["PUT"])) |
|
135 | 136 | m.connect("admin_settings_create_repository", "/create_repository", |
|
136 | 137 | action="create_repository", conditions=dict(method=["GET"])) |
|
137 | 138 | |
|
138 | 139 | #ADMIN MAIN PAGES |
|
139 | with map.submapper(path_prefix='/_admin', controller='admin/admin') as m: | |
|
140 | with routes_map.submapper(path_prefix='/_admin', controller='admin/admin') as m: | |
|
140 | 141 | m.connect('admin_home', '', action='index')#main page |
|
141 | 142 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
142 | 143 | action='add_repo') |
|
143 | 144 | |
|
144 | 145 | |
|
145 | 146 | #USER JOURNAL |
|
146 | map.connect('journal', '/_admin/journal', controller='journal',) | |
|
147 | map.connect('toggle_following', '/_admin/toggle_following', controller='journal', | |
|
147 | routes_map.connect('journal', '/_admin/journal', controller='journal',) | |
|
148 | routes_map.connect('toggle_following', '/_admin/toggle_following', controller='journal', | |
|
148 | 149 | action='toggle_following', conditions=dict(method=["POST"])) |
|
149 | 150 | |
|
150 | 151 | |
|
151 | 152 | #SEARCH |
|
152 | map.connect('search', '/_admin/search', controller='search',) | |
|
153 | map.connect('search_repo', '/_admin/search/{search_repo:.*}', controller='search') | |
|
153 | routes_map.connect('search', '/_admin/search', controller='search',) | |
|
154 | routes_map.connect('search_repo', '/_admin/search/{search_repo:.*}', controller='search') | |
|
154 | 155 | |
|
155 | 156 | #LOGIN/LOGOUT/REGISTER/SIGN IN |
|
156 | map.connect('login_home', '/_admin/login', controller='login') | |
|
157 | map.connect('logout_home', '/_admin/logout', controller='login', action='logout') | |
|
158 | map.connect('register', '/_admin/register', controller='login', action='register') | |
|
159 | map.connect('reset_password', '/_admin/password_reset', controller='login', action='password_reset') | |
|
157 | routes_map.connect('login_home', '/_admin/login', controller='login') | |
|
158 | routes_map.connect('logout_home', '/_admin/logout', controller='login', action='logout') | |
|
159 | routes_map.connect('register', '/_admin/register', controller='login', action='register') | |
|
160 | routes_map.connect('reset_password', '/_admin/password_reset', controller='login', action='password_reset') | |
|
160 | 161 | |
|
161 | 162 | #FEEDS |
|
162 | map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss', | |
|
163 | routes_map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss', | |
|
163 | 164 | controller='feed', action='rss', |
|
164 | 165 | conditions=dict(function=check_repo)) |
|
165 | map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom', | |
|
166 | routes_map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom', | |
|
166 | 167 | controller='feed', action='atom', |
|
167 | 168 | conditions=dict(function=check_repo)) |
|
168 | 169 | |
|
169 | 170 | |
|
170 | 171 | #REPOSITORY ROUTES |
|
171 | map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}', | |
|
172 | routes_map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}', | |
|
172 | 173 | controller='changeset', revision='tip', |
|
173 | 174 | conditions=dict(function=check_repo)) |
|
174 | map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}', | |
|
175 | routes_map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}', | |
|
175 | 176 | controller='changeset', action='raw_changeset', revision='tip', |
|
176 | 177 | conditions=dict(function=check_repo)) |
|
177 | map.connect('summary_home', '/{repo_name:.*}', | |
|
178 | routes_map.connect('summary_home', '/{repo_name:.*}', | |
|
178 | 179 | controller='summary', conditions=dict(function=check_repo)) |
|
179 | map.connect('summary_home', '/{repo_name:.*}/summary', | |
|
180 | routes_map.connect('summary_home', '/{repo_name:.*}/summary', | |
|
180 | 181 | controller='summary', conditions=dict(function=check_repo)) |
|
181 | map.connect('shortlog_home', '/{repo_name:.*}/shortlog', | |
|
182 | routes_map.connect('shortlog_home', '/{repo_name:.*}/shortlog', | |
|
182 | 183 | controller='shortlog', conditions=dict(function=check_repo)) |
|
183 | map.connect('branches_home', '/{repo_name:.*}/branches', | |
|
184 | routes_map.connect('branches_home', '/{repo_name:.*}/branches', | |
|
184 | 185 | controller='branches', conditions=dict(function=check_repo)) |
|
185 | map.connect('tags_home', '/{repo_name:.*}/tags', | |
|
186 | routes_map.connect('tags_home', '/{repo_name:.*}/tags', | |
|
186 | 187 | controller='tags', conditions=dict(function=check_repo)) |
|
187 | map.connect('changelog_home', '/{repo_name:.*}/changelog', | |
|
188 | routes_map.connect('changelog_home', '/{repo_name:.*}/changelog', | |
|
188 | 189 | controller='changelog', conditions=dict(function=check_repo)) |
|
189 | map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}', | |
|
190 | routes_map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}', | |
|
190 | 191 | controller='files', revision='tip', f_path='', |
|
191 | 192 | conditions=dict(function=check_repo)) |
|
192 | map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', | |
|
193 | routes_map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', | |
|
193 | 194 | controller='files', action='diff', revision='tip', f_path='', |
|
194 | 195 | conditions=dict(function=check_repo)) |
|
195 | map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', | |
|
196 | routes_map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', | |
|
196 | 197 | controller='files', action='rawfile', revision='tip', f_path='', |
|
197 | 198 | conditions=dict(function=check_repo)) |
|
198 | map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}', | |
|
199 | routes_map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}', | |
|
199 | 200 | controller='files', action='raw', revision='tip', f_path='', |
|
200 | 201 | conditions=dict(function=check_repo)) |
|
201 | map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', | |
|
202 | routes_map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', | |
|
202 | 203 | controller='files', action='annotate', revision='tip', f_path='', |
|
203 | 204 | conditions=dict(function=check_repo)) |
|
204 | map.connect('files_archive_home', '/{repo_name:.*}/archive/{fname}', | |
|
205 | routes_map.connect('files_archive_home', '/{repo_name:.*}/archive/{fname}', | |
|
205 | 206 | controller='files', action='archivefile', |
|
206 | 207 | conditions=dict(function=check_repo)) |
|
207 | map.connect('repo_settings_delete', '/{repo_name:.*}/settings', | |
|
208 | routes_map.connect('repo_settings_delete', '/{repo_name:.*}/settings', | |
|
208 | 209 | controller='settings', action="delete", |
|
209 | 210 | conditions=dict(method=["DELETE"], function=check_repo)) |
|
210 | map.connect('repo_settings_update', '/{repo_name:.*}/settings', | |
|
211 | routes_map.connect('repo_settings_update', '/{repo_name:.*}/settings', | |
|
211 | 212 | controller='settings', action="update", |
|
212 | 213 | conditions=dict(method=["PUT"], function=check_repo)) |
|
213 | map.connect('repo_settings_home', '/{repo_name:.*}/settings', | |
|
214 | routes_map.connect('repo_settings_home', '/{repo_name:.*}/settings', | |
|
214 | 215 | controller='settings', action='index', |
|
215 | 216 | conditions=dict(function=check_repo)) |
|
216 | 217 | |
|
217 | map.connect('repo_fork_create_home', '/{repo_name:.*}/fork', | |
|
218 | routes_map.connect('repo_fork_create_home', '/{repo_name:.*}/fork', | |
|
218 | 219 | controller='settings', action='fork_create', |
|
219 | 220 | conditions=dict(function=check_repo, method=["POST"])) |
|
220 | map.connect('repo_fork_home', '/{repo_name:.*}/fork', | |
|
221 | routes_map.connect('repo_fork_home', '/{repo_name:.*}/fork', | |
|
221 | 222 | controller='settings', action='fork', |
|
222 | 223 | conditions=dict(function=check_repo)) |
|
223 | 224 | |
|
224 | return map | |
|
225 | return routes_map |
General Comments 0
You need to be logged in to leave comments.
Login now