misc: remove dead page template key (mobile/iframe) code (#34820)

This commit is contained in:
Frédéric Péters 2019-07-14 20:35:49 +02:00
parent 5c41abb769
commit f7af451d05
4 changed files with 3 additions and 25 deletions

View File

@ -123,15 +123,7 @@ class FargoDirectory(Directory):
def pick(self):
request = get_request()
if 'cancel' in request.form:
get_response().add_javascript(['jquery.js'])
get_response().page_template_key = 'iframe'
r = TemplateIO(html=True)
r += htmltext('<html><body>')
r += htmltext('<script>window.top.document.fargo_close_dialog();</script>')
r += htmltext('</body></html>')
return r.getvalue()
elif 'url' in request.form:
if 'url' in request.form:
# Download file
# FIXME: handle error cases
url = request.form['url']

View File

@ -40,7 +40,6 @@ class HTTPResponse(quixote.http_response.HTTPResponse):
javascript_code_parts = None
css_includes = None
after_jobs = None
page_template_key = None
def __init__(self, charset=None, **kwargs):
quixote.http_response.HTTPResponse.__init__(self, charset = charset, **kwargs)

View File

@ -169,7 +169,6 @@ class QommonPublisher(Publisher, object):
request = get_request()
original_response = request.response
request.response = HTTPResponse(status=exc.status_code)
request.response.page_template_key = original_response.page_template_key
if request.is_json():
request.response.set_content_type('application/json')
return json.dumps({'err': 1, 'err_class': exc.title, 'err_desc': exc.public_msg})
@ -310,7 +309,6 @@ class QommonPublisher(Publisher, object):
request = get_request()
original_response = request.response
request.response = HTTPResponse()
request.response.page_template_key = original_response.page_template_key
if self.statsd: # maybe unset if very early failure
self.statsd.increment('failed-request')
@ -533,9 +531,6 @@ class QommonPublisher(Publisher, object):
self.initialize_app_dir()
self.set_config(request)
if request.get_environ('QOMMON_PAGE_TEMPLATE_KEY'):
request.response.page_template_key = request.get_environ('QOMMON_PAGE_TEMPLATE_KEY')
request.language = self.get_site_language()
self.install_lang(request)
self.init_publisher_substitutions(request)

View File

@ -367,14 +367,9 @@ def decorate(body, response):
if True:
template_ezt = get_cfg('branding', {}).get('template')
current_theme = get_cfg('branding', {}).get('theme', 'default')
if response.page_template_key or not template_ezt:
if not template_ezt:
# the theme can provide a default template
possible_filenames = []
if response.page_template_key:
possible_filenames.append('template.%s.%s.ezt' % (
get_publisher().APP_NAME, response.page_template_key))
possible_filenames.append('template.%s.ezt' % response.page_template_key)
possible_filenames.append('template.%s.ezt' % get_publisher().APP_NAME)
possible_filenames.append('template.ezt')
@ -400,10 +395,7 @@ def decorate(body, response):
template = ezt.Template()
template.parse(template_ezt)
else:
if response.page_template_key == 'iframe':
template = default_iframe_template
else:
template = default_template
template = default_template
fd = StringIO()
vars = get_decorate_vars(body, response,