Set a starting value for session.send_new_cookie.
authorBrett Smith <brettcsmith@brettcsmith.org>
Sun, 24 Mar 2013 19:39:49 +0000 (15:39 -0400)
committerBrett Smith <brettcsmith@brettcsmith.org>
Sun, 24 Mar 2013 19:39:49 +0000 (15:39 -0400)
This makes session.__init__ slightly more complicated but probably
simplifies everything else, especially if we make the class smarter
later by having it track changes itself.

mediagoblin/tools/session.py

index 303907b9e337f826cb0898557ae7280293df56cb..da53ddf05a3bc89bb73d57f2ead041acede59dbc 100644 (file)
@@ -22,11 +22,15 @@ import crypto
 _log = logging.getLogger(__name__)
 
 class Session(dict):
+    def __init__(self, *args, **kwargs):
+        self.send_new_cookie = False
+        dict.__init__(self, *args, **kwargs)
+
     def save(self):
         self.send_new_cookie = True
 
     def is_updated(self):
-        return getattr(self, 'send_new_cookie')
+        return self.send_new_cookie
 
     def delete(self):
         self.clear()