Show More
@@ -1,81 +1,81 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2016-2020 RhodeCode GmbH |
|
3 | # Copyright (C) 2016-2020 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 | from rhodecode.apps._base import ADMIN_PREFIX |
|
20 | from rhodecode.apps._base import ADMIN_PREFIX | |
21 | from rhodecode.lib.utils2 import str2bool |
|
21 | from rhodecode.lib.utils2 import str2bool | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | class DebugStylePredicate(object): |
|
24 | class DebugStylePredicate(object): | |
25 | def __init__(self, val, config): |
|
25 | def __init__(self, val, config): | |
26 | self.val = val |
|
26 | self.val = val | |
27 |
|
27 | |||
28 | def text(self): |
|
28 | def text(self): | |
29 |
return 'debug style route = |
|
29 | return f'debug style route = {self.val}' | |
30 |
|
30 | |||
31 | phash = text |
|
31 | phash = text | |
32 |
|
32 | |||
33 | def __call__(self, info, request): |
|
33 | def __call__(self, info, request): | |
34 | return str2bool(request.registry.settings.get('debug_style')) |
|
34 | return str2bool(request.registry.settings.get('debug_style')) | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | def includeme(config): |
|
37 | def includeme(config): | |
38 | from rhodecode.apps.debug_style.views import DebugStyleView |
|
38 | from rhodecode.apps.debug_style.views import DebugStyleView | |
39 |
|
39 | |||
40 | config.add_route_predicate( |
|
40 | config.add_route_predicate( | |
41 | 'debug_style', DebugStylePredicate) |
|
41 | 'debug_style', DebugStylePredicate) | |
42 |
|
42 | |||
43 | config.add_route( |
|
43 | config.add_route( | |
44 | name='debug_style_home', |
|
44 | name='debug_style_home', | |
45 | pattern=ADMIN_PREFIX + '/debug_style', |
|
45 | pattern=ADMIN_PREFIX + '/debug_style', | |
46 | debug_style=True) |
|
46 | debug_style=True) | |
47 | config.add_view( |
|
47 | config.add_view( | |
48 | DebugStyleView, |
|
48 | DebugStyleView, | |
49 | attr='index', |
|
49 | attr='index', | |
50 | route_name='debug_style_home', request_method='GET', |
|
50 | route_name='debug_style_home', request_method='GET', | |
51 | renderer=None) |
|
51 | renderer=None) | |
52 |
|
52 | |||
53 | config.add_route( |
|
53 | config.add_route( | |
54 | name='debug_style_email', |
|
54 | name='debug_style_email', | |
55 | pattern=ADMIN_PREFIX + '/debug_style/email/{email_id}', |
|
55 | pattern=ADMIN_PREFIX + '/debug_style/email/{email_id}', | |
56 | debug_style=True) |
|
56 | debug_style=True) | |
57 | config.add_view( |
|
57 | config.add_view( | |
58 | DebugStyleView, |
|
58 | DebugStyleView, | |
59 | attr='render_email', |
|
59 | attr='render_email', | |
60 | route_name='debug_style_email', request_method='GET', |
|
60 | route_name='debug_style_email', request_method='GET', | |
61 | renderer=None) |
|
61 | renderer=None) | |
62 |
|
62 | |||
63 | config.add_route( |
|
63 | config.add_route( | |
64 | name='debug_style_email_plain_rendered', |
|
64 | name='debug_style_email_plain_rendered', | |
65 | pattern=ADMIN_PREFIX + '/debug_style/email-rendered/{email_id}', |
|
65 | pattern=ADMIN_PREFIX + '/debug_style/email-rendered/{email_id}', | |
66 | debug_style=True) |
|
66 | debug_style=True) | |
67 | config.add_view( |
|
67 | config.add_view( | |
68 | DebugStyleView, |
|
68 | DebugStyleView, | |
69 | attr='render_email', |
|
69 | attr='render_email', | |
70 | route_name='debug_style_email_plain_rendered', request_method='GET', |
|
70 | route_name='debug_style_email_plain_rendered', request_method='GET', | |
71 | renderer=None) |
|
71 | renderer=None) | |
72 |
|
72 | |||
73 | config.add_route( |
|
73 | config.add_route( | |
74 | name='debug_style_template', |
|
74 | name='debug_style_template', | |
75 | pattern=ADMIN_PREFIX + '/debug_style/t/{t_path}', |
|
75 | pattern=ADMIN_PREFIX + '/debug_style/t/{t_path}', | |
76 | debug_style=True) |
|
76 | debug_style=True) | |
77 | config.add_view( |
|
77 | config.add_view( | |
78 | DebugStyleView, |
|
78 | DebugStyleView, | |
79 | attr='template', |
|
79 | attr='template', | |
80 | route_name='debug_style_template', request_method='GET', |
|
80 | route_name='debug_style_template', request_method='GET', | |
81 | renderer=None) |
|
81 | renderer=None) |
General Comments 0
You need to be logged in to leave comments.
Login now