[sagenb] 140/179: Get rid of custom SageNBFlask.save_session

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit 72328b2bbe7d7ce4b50c9d250720a2a67b74c0c0
Author: Keshav Kini <keshav.kini at gmail.com>
Date:   Sat Jun 22 17:36:25 2013 -0700

    Get rid of custom SageNBFlask.save_session
    
    This hack probably hasn't been needed for a while but now it's started
    actively breaking so it's time to get rid of it. The docstring of the
    function says "This method needs to stay in sync with the version in
    Flask", but it hasn't been since 2011 [1].
    
    This change shouldn't affect behavior - the value of the `httponly` flag
    that's eventually passed to a newer incarnation of `save_cookie` is read
    from the app object's config pseudodictionary. See [2] and [3].
    
    [1] https://github.com/mitsuhiko/flask/blame/0.10.1/flask/app.py#L837
    [2] https://github.com/mitsuhiko/flask/blob/0.10.1/flask/sessions.py#L323
    [3] https://github.com/mitsuhiko/flask/blob/0.10.1/flask/sessions.py#L233
---
 flask_version/base.py | 24 ++----------------------
 setup.py              |  2 +-
 util/fetch_deps.py    |  2 +-
 3 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/flask_version/base.py b/flask_version/base.py
index b961186..5e879aa 100755
--- a/flask_version/base.py
+++ b/flask_version/base.py
@@ -24,6 +24,8 @@ class SageNBFlask(Flask):
         self.startup_token = kwds.pop('startup_token', None)
         Flask.__init__(self, *args, **kwds)
 
+        self.config['SESSION_COOKIE_HTTPONLY'] = False
+
         self.root_path = SAGENB_ROOT
 
         self.add_static_path('/css', os.path.join(DATA, "sage", "css"))
@@ -59,28 +61,6 @@ class SageNBFlask(Flask):
                           endpoint='/static'+base_url,
                           view_func=partial(self.static_view_func, root_path))
 
-    def save_session(self, session, response):
-        """
-        This method needs to stay in sync with the version in Flask.
-        The only modification made to it is the ``httponly=False``
-        passed to ``save_cookie``.
-
-        Saves the session if it needs updates.  For the default
-        implementation, check :meth:`open_session`.
-
-        :param session: the session to be saved (a
-                        :class:`~werkzeug.contrib.securecookie.SecureCookie`
-                        object)
-        :param response: an instance of :attr:`response_class`
-        """
-        expires = domain = None
-        if session.permanent:
-            expires = datetime.utcnow() + self.permanent_session_lifetime
-        if self.config['SERVER_NAME'] is not None:
-            domain = '.' + self.config['SERVER_NAME']
-        session.save_cookie(response, self.session_cookie_name,
-                            expires=expires, httponly=False, domain=domain)
-
     def message(self, msg, cont='/', username=None, **kwds):
         """Returns an error message to the user."""
         template_dict = {'msg': msg, 'cont': cont, 'username': username}
diff --git a/setup.py b/setup.py
index 900bc6c..d495d15 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ def all_files(dir, prefix):
 
 
 install_requires = [ 'twisted>=11.0.0'
-                   , 'flask'
+                   , 'flask>=0.10.1'
                    , 'flask-openid'
                    , 'flask-autoindex'
                    , 'babel'
diff --git a/util/fetch_deps.py b/util/fetch_deps.py
index c85b9ea..40d3a10 100644
--- a/util/fetch_deps.py
+++ b/util/fetch_deps.py
@@ -16,7 +16,7 @@ required_packages = [ 'zope.interface'
                     , 'speaklater>=1.2'
                     , 'python-openid>=2.2.5'
                     , 'itsdangerous>=0.21'
-                    , 'Flask>=0.8'
+                    , 'Flask>=0.10.1'
                     , 'Flask-Silk>=0.1.1'
                     , 'Flask-AutoIndex>=0.4.0'
                     , 'Flask-Babel>=0.8'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list