pyramid: fixed some deprecated calls.

This commit is contained in:
Daniel Dourvaris 2018-10-01 10:16:57 +02:00
parent 1db967ddb0
commit 3801dc220e
2 changed files with 73 additions and 55 deletions

View file

@ -21,22 +21,30 @@ from rhodecode.apps._base import ADMIN_PREFIX
from rhodecode.lib.utils2 import str2bool
def debug_style_enabled(info, request):
return str2bool(request.registry.settings.get('debug_style'))
class DebugStylePredicate(object):
def __init__(self, val, config):
self.val = val
def text(self):
return 'debug style route = %s' % self.val
phash = text
def __call__(self, info, request):
str2bool(request.registry.settings.get('debug_style'))
def includeme(config):
config.add_route_predicate(
'debug_style', DebugStylePredicate)
config.add_route(
name='debug_style_home',
pattern=ADMIN_PREFIX + '/debug_style',
custom_predicates=(debug_style_enabled,))
debug_style=True)
config.add_route(
name='debug_style_template',
pattern=ADMIN_PREFIX + '/debug_style/t/{t_path}',
custom_predicates=(debug_style_enabled,))
debug_style=True)
# Scan module for configuration decorators.
config.scan('.views', ignore='.tests')