Commits

Mike Dirolf committed aad2330

Fix bug when creating a new session with an expiration date.

Comments (0)

Files changed (2)

beaker/session.py

             self['_id'] = _session_id()
         self['_accessed_time'] = time.time()
 
+        val = self._encrypt_data()
+        if len(val) > 4064:
+            raise BeakerException("Cookie value is too long to store")
+
+        self.cookie[self.key] = val
+
         if '_expires' in self:
             expires = self['_expires']
         else:
         if expires is not None:
             self['_expires'] = expires
 
-        val = self._encrypt_data()
-        if len(val) > 4064:
-            raise BeakerException("Cookie value is too long to store")
-
-        self.cookie[self.key] = val
         if '_domain' in self:
             self.cookie[self.key]['domain'] = self['_domain']
         elif self._domain: