diff options
Diffstat (limited to 'paste/auth/cookie.py')
-rw-r--r-- | paste/auth/cookie.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/paste/auth/cookie.py b/paste/auth/cookie.py index 8f11d1b..d00f17b 100644 --- a/paste/auth/cookie.py +++ b/paste/auth/cookie.py @@ -144,10 +144,17 @@ class AuthCookieSigner(object): if six.PY3: content = content.encode('utf8') timestamp = timestamp.encode('utf8') - cookie = base64.encodestring( - hmac.new(self.secret, content, sha1).digest() + - timestamp + - content) + + if six.PY3: + cookie = base64.encodebytes( + hmac.new(self.secret, content, sha1).digest() + + timestamp + + content) + else: + cookie = base64.encodestring( + hmac.new(self.secret, content, sha1).digest() + + timestamp + + content) cookie = cookie.replace(b"/", b"_").replace(b"=", b"~") cookie = cookie.replace(b'\n', b'').replace(b'\r', b'') if len(cookie) > self.maxlen: |