##// END OF EJS Templates
pyramid: allows easier turning off the pylons components.
marcink -
r1912:f0e0aac6 default
parent child Browse files
Show More
@@ -124,8 +124,12 b' class BaseAppView(object):'
124 124
125 125 # TODO(marcink): remove once pyramid migration is finished
126 126 from pylons import tmpl_context as c
127 try:
127 128 for k, v in tmpl_args.items():
128 129 setattr(c, k, v)
130 except TypeError:
131 log.exception('Failed to register pylons C')
132 pass
129 133
130 134 def _get_template_context(self, tmpl_args):
131 135 self._register_global_c(tmpl_args)
@@ -345,7 +345,7 b' def includeme(config):'
345 345 config.add_notfound_view(make_not_found_view(config))
346 346
347 347 if not settings.get('debugtoolbar.enabled', False):
348 # if no toolbar, then any exception gets caught and rendered
348 # disabled debugtoolbar handle all exceptions via the error_handlers
349 349 config.add_view(error_handler, context=Exception)
350 350
351 351 config.add_view(error_handler, context=HTTPError)
@@ -388,8 +388,12 b' def wrap_app_in_wsgi_middlewares(pyramid'
388 388
389 389 # Add RoutesMiddleware to support the pylons compatibility tween during
390 390 # migration to pyramid.
391
392 # TODO(marcink): remove after migration to pyramid
393 if hasattr(config.registry, '_pylons_compat_config'):
394 routes_map = config.registry._pylons_compat_config['routes.map']
391 395 pyramid_app = SkippableRoutesMiddleware(
392 pyramid_app, config.registry._pylons_compat_config['routes.map'],
396 pyramid_app, routes_map,
393 397 skip_prefixes=(STATIC_FILE_PREFIX, '/_debug_toolbar'))
394 398
395 399 pyramid_app, _ = wrap_in_appenlight_if_enabled(pyramid_app, settings)
@@ -48,7 +48,6 b' from pygments.formatters.html import Htm'
48 48 from pygments import highlight as code_highlight
49 49 from pygments.lexers import (
50 50 get_lexer_by_name, get_lexer_for_filename, get_lexer_for_mimetype)
51 from pylons import url as pylons_url
52 51 from pylons.i18n.translation import _, ungettext
53 52 from pyramid.threadlocal import get_current_request
54 53
@@ -94,6 +93,7 b' DEFAULT_USER_EMAIL = User.DEFAULT_USER_E'
94 93
95 94
96 95 def url(*args, **kw):
96 from pylons import url as pylons_url
97 97 return pylons_url(*args, **kw)
98 98
99 99
@@ -103,6 +103,7 b' def pylons_url_current(*args, **kw):'
103 103 path so that it will also work from a pyramid only context. This
104 104 should be removed once port to pyramid is complete.
105 105 """
106 from pylons import url as pylons_url
106 107 if not args and not kw:
107 108 request = get_current_request()
108 109 return request.path
@@ -232,6 +232,8 b' def write_js_routes_if_enabled(event):'
232 232
233 233 def get_routes():
234 234 # pylons routes
235 # TODO(marcink): remove when pyramid migration is finished
236 if 'routes.map' in rhodecode.CONFIG:
235 237 for route in rhodecode.CONFIG['routes.map'].jsroutes():
236 238 yield route
237 239
General Comments 0
You need to be logged in to leave comments. Login now