summaryrefslogtreecommitdiff
path: root/paste/auth
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-08-21 23:00:23 +0000
committerianb <devnull@localhost>2006-08-21 23:00:23 +0000
commit823a63518e5979091cfae393e0c01758c74ef822 (patch)
tree231d743ca818dd6a1f4f19b12bfa66768fdddbd9 /paste/auth
parentde49f36ca941b08127c31c1d711edd07d3a0f471 (diff)
downloadpaste-823a63518e5979091cfae393e0c01758c74ef822.tar.gz
Make sure timeout isn't passed in as a string
Diffstat (limited to 'paste/auth')
-rw-r--r--paste/auth/cookie.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/paste/auth/cookie.py b/paste/auth/cookie.py
index b4ed0b4..ebb9aba 100644
--- a/paste/auth/cookie.py
+++ b/paste/auth/cookie.py
@@ -49,6 +49,7 @@ def make_time(value):
_signature_size = len(hmac.new('x','x',sha).digest())
_header_size = _signature_size + len(make_time(time.time()))
+# @@: Should this be using urllib.quote?
# build encode/decode functions to safely pack away values
_encode = [('\\','\\x5c'),('"','\\x22'),('=','\\x3d'),(';','\\x3b')]
_decode = [(v,k) for (k,v) in _encode]
@@ -116,6 +117,10 @@ class AuthCookieSigner:
"""
def __init__(self, secret = None, timeout = None, maxlen = None):
self.timeout = timeout or 30
+ if isinstance(timeout, basestring):
+ raise ValueError(
+ "Timeout must be a number (minutes), not a string (%r)"
+ % timeout)
self.maxlen = maxlen or 4096
self.secret = secret or new_secret()