Show More
@@ -273,6 +273,11 b' def includeme(config):' | |||||
273 | if asbool(settings.get('appenlight', 'false')): |
|
273 | if asbool(settings.get('appenlight', 'false')): | |
274 | config.include('appenlight_client.ext.pyramid_tween') |
|
274 | config.include('appenlight_client.ext.pyramid_tween') | |
275 |
|
275 | |||
|
276 | if not 'mako.default_filters' in settings: | |||
|
277 | # set custom default filters if we don't have it defined | |||
|
278 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' | |||
|
279 | settings['mako.default_filters'] = 'h_filter' | |||
|
280 | ||||
276 | # Includes which are required. The application would fail without them. |
|
281 | # Includes which are required. The application would fail without them. | |
277 | config.include('pyramid_mako') |
|
282 | config.include('pyramid_mako') | |
278 | config.include('pyramid_beaker') |
|
283 | config.include('pyramid_beaker') |
@@ -27,6 +27,7 b' controllers' | |||||
27 | import logging |
|
27 | import logging | |
28 | import socket |
|
28 | import socket | |
29 |
|
29 | |||
|
30 | import markupsafe | |||
30 | import ipaddress |
|
31 | import ipaddress | |
31 | import pyramid.threadlocal |
|
32 | import pyramid.threadlocal | |
32 |
|
33 | |||
@@ -570,6 +571,17 b' class BaseController(WSGIController):' | |||||
570 | return WSGIController.__call__(self, environ, start_response) |
|
571 | return WSGIController.__call__(self, environ, start_response) | |
571 |
|
572 | |||
572 |
|
573 | |||
|
574 | def h_filter(s): | |||
|
575 | """ | |||
|
576 | Custom filter for Mako templates. Mako by standard uses `markupsafe.escape` | |||
|
577 | we wrap this with additional functionality that converts None to empty | |||
|
578 | strings | |||
|
579 | """ | |||
|
580 | if s is None: | |||
|
581 | return markupsafe.Markup() | |||
|
582 | return markupsafe.escape(s) | |||
|
583 | ||||
|
584 | ||||
573 | class BaseRepoController(BaseController): |
|
585 | class BaseRepoController(BaseController): | |
574 | """ |
|
586 | """ | |
575 | Base class for controllers responsible for loading all needed data for |
|
587 | Base class for controllers responsible for loading all needed data for |
General Comments 0
You need to be logged in to leave comments.
Login now