##// END OF EJS Templates
fstring: improved formatting
super-admin -
r5017:b0894351 default
parent child Browse files
Show More
@@ -1,81 +1,81 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2016-2020 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 from rhodecode.apps._base import ADMIN_PREFIX
21 21 from rhodecode.lib.utils2 import str2bool
22 22
23 23
24 24 class DebugStylePredicate(object):
25 25 def __init__(self, val, config):
26 26 self.val = val
27 27
28 28 def text(self):
29 return 'debug style route = %s' % self.val
29 return f'debug style route = {self.val}'
30 30
31 31 phash = text
32 32
33 33 def __call__(self, info, request):
34 34 return str2bool(request.registry.settings.get('debug_style'))
35 35
36 36
37 37 def includeme(config):
38 38 from rhodecode.apps.debug_style.views import DebugStyleView
39 39
40 40 config.add_route_predicate(
41 41 'debug_style', DebugStylePredicate)
42 42
43 43 config.add_route(
44 44 name='debug_style_home',
45 45 pattern=ADMIN_PREFIX + '/debug_style',
46 46 debug_style=True)
47 47 config.add_view(
48 48 DebugStyleView,
49 49 attr='index',
50 50 route_name='debug_style_home', request_method='GET',
51 51 renderer=None)
52 52
53 53 config.add_route(
54 54 name='debug_style_email',
55 55 pattern=ADMIN_PREFIX + '/debug_style/email/{email_id}',
56 56 debug_style=True)
57 57 config.add_view(
58 58 DebugStyleView,
59 59 attr='render_email',
60 60 route_name='debug_style_email', request_method='GET',
61 61 renderer=None)
62 62
63 63 config.add_route(
64 64 name='debug_style_email_plain_rendered',
65 65 pattern=ADMIN_PREFIX + '/debug_style/email-rendered/{email_id}',
66 66 debug_style=True)
67 67 config.add_view(
68 68 DebugStyleView,
69 69 attr='render_email',
70 70 route_name='debug_style_email_plain_rendered', request_method='GET',
71 71 renderer=None)
72 72
73 73 config.add_route(
74 74 name='debug_style_template',
75 75 pattern=ADMIN_PREFIX + '/debug_style/t/{t_path}',
76 76 debug_style=True)
77 77 config.add_view(
78 78 DebugStyleView,
79 79 attr='template',
80 80 route_name='debug_style_template', request_method='GET',
81 81 renderer=None)
General Comments 0
You need to be logged in to leave comments. Login now