Commits

Anonymous committed 1e47299

[svn] * Beaker was not properly parsing input options to session middleware. Thanks
to Yannick Gingras for spotting the issue.

Comments (0)

Files changed (3)

 =================
 
 0.7.3 (**svn**)
+* Beaker was not properly parsing input options to session middleware. Thanks
+  to Yannick Gingras for spotting the issue.
 * Changed session to only send the cookie header if its a new session and
   save() was called. Also only creates the session file under these 
   conditions.

beaker/session.py

                 self.options[key[8:]] = val
         
         # Coerce and validate session params
-        coerce_session_params(config)
+        coerce_session_params(self.options)
         
-        # Update the params with the ones passed in
-        self.options.update(config)
+        # Assume all keys are intended for cache if none are prefixed with 'cache.'
+        if not self.options and not config:
+            self.options = config
+        
         self.options.update(kwargs)
-        
         self.wrap_app = wrap_app
         self.environ_key = environ_key
         
 import os
 import sha
 import string
+import types
 import weakref
 
 try:
     rules = [
         ('data_dir', (str,), "data_dir must be a string referring to a directory."),
         ('lock_dir', (str,), "lock_dir must be a string referring to a directory."),
-        ('type', (str,), "Session type must be a string."),
+        ('type', (str, types.NoneType), "Session type must be a string."),
         ('cookie_expires', (bool, datetime, timedelta), "Cookie expires was not a boolean, datetime, or timedelta instance."),
         ('id', (str,), "Session id must be a string."),
         ('key', (str,), "Session key must be a string."),
-        ('secret', (str,), "Session secret must be a string."),
-        ('timeout', (int,), "Session timeout must be an integer."),
+        ('secret', (str, types.NoneType), "Session secret must be a string."),
+        ('timeout', (int, types.NoneType), "Session timeout must be an integer."),
     ]
     return verify_rules(params, rules)