From c02d4dc3873b5e8c07b0522185e2799a42eac709 Mon Sep 17 00:00:00 2001 From: 0x155 Date: Wed, 20 Dec 2017 21:29:46 +0100 Subject: [PATCH] Init new attribute implementation --- flask/sessions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flask/sessions.py b/flask/sessions.py index 82b588bc..7e82fda0 100644 --- a/flask/sessions.py +++ b/flask/sessions.py @@ -61,21 +61,30 @@ class SecureCookieSession(CallbackDict, SessionMixin): def on_update(self): self.modified = True self.accessed = True + self.new = True super(SecureCookieSession, self).__init__(initial, on_update) self.modified = False self.accessed = False + if not hasattr(self, 'has_run'): + self.has_run = True + self.new = False + else: + self.new = True def __getitem__(self, key): self.accessed = True + self.new = False return super(SecureCookieSession, self).__getitem__(key) def get(self, key, default=None): self.accessed = True + self.new = False return super(SecureCookieSession, self).get(key, default) def setdefault(self, key, default=None): self.accessed = True + self.new = False return super(SecureCookieSession, self).setdefault(key, default)