Projet

Général

Profil

0001-misc-remove-old-mobile-mode-25942.patch

Frédéric Péters, 14 juillet 2019 19:15

Télécharger (2,55 ko)

Voir les différences:

Subject: [PATCH] misc: remove old mobile mode (#25942)

 wcs/middleware.py       | 16 ----------------
 wcs/qommon/publisher.py |  8 --------
 2 files changed, 24 deletions(-)
wcs/middleware.py
54 54

  
55 55
        request._publisher = pub
56 56

  
57
        # if a ?toggle-mobile query string is passed, we explicitely set the
58
        # mode and reload the current page.
59
        if compat_request.get_query() == 'toggle-mobile':
60
            response = HttpResponseRedirect(compat_request.get_path())
61
            if pub.config.session_cookie_path:
62
                path = pub.config.session_cookie_path
63
            else:
64
                path = compat_request.get_environ('SCRIPT_NAME')
65
                if not path.endswith('/'):
66
                    path += '/'
67
            if compat_request.response.page_template_key == 'mobile':
68
                response.set_cookie('mobile', 'false', path=path)
69
            else:
70
                response.set_cookie('mobile', 'true', path=path)
71
            return response
72

  
73 57
        # handle session_var_<xxx> in query strings, add them to session and
74 58
        # redirect to same URL without the parameters
75 59
        if compat_request.get_method() == 'GET' and compat_request.form:
wcs/qommon/publisher.py
554 554
            # if the mobile mode is explicitely disabled, we will use the
555 555
            # default theme variant
556 556
            request.response.page_template_key = None
557
        elif request.get_cookie('mobile') == 'true':
558
            # if the mobile mode is explicitely asked, we will use the mobile
559
            # theme variant
560
            request.response.page_template_key = 'mobile'
561
        elif request.has_mobile_user_agent():
562
            # if a mobile user agent is detected and there are no explicit
563
            # direction, we will use the mobile theme variant
564
            request.response.page_template_key = 'mobile'
565 557

  
566 558
        if request.get_environ('QOMMON_PAGE_TEMPLATE_KEY'):
567 559
            request.response.page_template_key = request.get_environ('QOMMON_PAGE_TEMPLATE_KEY')
568
-