misc: remove old mobile mode (#25942)

This commit is contained in:
Frédéric Péters 2018-08-20 17:34:58 +02:00
parent e1d2d38ce4
commit 62a766c4a9
2 changed files with 0 additions and 44 deletions

View File

@ -54,22 +54,6 @@ class PublisherInitialisationMiddleware(object):
request._publisher = pub
# if a ?toggle-mobile query string is passed, we explicitely set the
# mode and reload the current page.
if compat_request.get_query() == 'toggle-mobile':
response = HttpResponseRedirect(compat_request.get_path())
if pub.config.session_cookie_path:
path = pub.config.session_cookie_path
else:
path = compat_request.get_environ('SCRIPT_NAME')
if not path.endswith('/'):
path += '/'
if compat_request.response.page_template_key == 'mobile':
response.set_cookie('mobile', 'false', path=path)
else:
response.set_cookie('mobile', 'true', path=path)
return response
# handle session_var_<xxx> in query strings, add them to session and
# redirect to same URL without the parameters
if compat_request.get_method() == 'GET' and compat_request.form:

View File

@ -482,11 +482,6 @@ class QommonPublisher(Publisher, object):
'''
self.site_options = None # reset at the beginning of a request
canonical_hostname = request.get_server(clean = False).lower().split(':')[0].rstrip('.')
for prefix in ['mobile', 'm']:
if canonical_hostname.startswith(prefix + '.') or \
canonical_hostname.startswith(prefix + '-'):
canonical_hostname = canonical_hostname[len(prefix)+1:]
break
script_name = request.get_header('SCRIPT_NAME', '').strip('/')
self.app_dir = os.path.join(self.APP_DIR, canonical_hostname)
@ -536,31 +531,8 @@ class QommonPublisher(Publisher, object):
os.path.split(self.app_dir)[-1].replace('+', '-').replace('.', '-')))
self.initialize_app_dir()
# determine appropriate theme variant
canonical_hostname = request.get_server(False).lower().split(':')[0].rstrip('.')
override_template_keys = {'m': 'mobile'}
for prefix in ['mobile', 'm']:
if canonical_hostname.startswith(prefix + '.') or \
canonical_hostname.startswith(prefix + '-'):
request.response.page_template_key = override_template_keys.get(prefix, prefix)
break
self.set_config(request)
if request.get_cookie('mobile') == 'false':
# if the mobile mode is explicitely disabled, we will use the
# default theme variant
request.response.page_template_key = None
elif request.get_cookie('mobile') == 'true':
# if the mobile mode is explicitely asked, we will use the mobile
# theme variant
request.response.page_template_key = 'mobile'
elif request.has_mobile_user_agent():
# if a mobile user agent is detected and there are no explicit
# direction, we will use the mobile theme variant
request.response.page_template_key = 'mobile'
if request.get_environ('QOMMON_PAGE_TEMPLATE_KEY'):
request.response.page_template_key = request.get_environ('QOMMON_PAGE_TEMPLATE_KEY')