misc: add publisher.render_response to render response with template (#15806)
This will allow the auquotidien module to override that method in a safer way than playing with module-level symbols.
This commit is contained in:
parent
21e0603aa7
commit
f92f41cb7c
|
@ -474,7 +474,7 @@ def can_decorate_as_pdf():
|
|||
|
||||
def decorate_as_pdf(content):
|
||||
from qommon import template
|
||||
html_page = template.decorate(content, get_response())
|
||||
html_page = get_publisher().render_response(content)
|
||||
html_page = html_page.replace('<head>',
|
||||
'<head><base href="%s"><meta charset="%s">' %
|
||||
(get_publisher().get_frontoffice_url(),
|
||||
|
|
|
@ -380,13 +380,16 @@ class QommonPublisher(Publisher, object):
|
|||
if not hasattr(response, 'filter') or not response.filter:
|
||||
return output
|
||||
try:
|
||||
return template.decorate(output, response)
|
||||
return self.render_response(output)
|
||||
except:
|
||||
# Something went wrong applying the template, maybe an error in it;
|
||||
# fail the request properly, to get the error into the logs, the
|
||||
# trace sent by email, etc.
|
||||
return self.finish_failed_request()
|
||||
|
||||
def render_response(self, content):
|
||||
return template.decorate(content, self.get_request().response)
|
||||
|
||||
def get_translation(self, lang):
|
||||
'''Retrieve a translation object for the given language and
|
||||
the current theme site.'''
|
||||
|
|
Loading…
Reference in New Issue