Permalink
Browse files

little changes for compatibility with python3.2

  • Loading branch information...
1 parent 465b4bb commit 97b2c8a109ce5f26cea4dcdd624c2bdf708d2acc @jellonek jellonek committed Mar 9, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 pyramid_beaker/__init__.py
@@ -9,6 +9,8 @@
from pyramid.settings import asbool
from zope.interface import implements
+from binascii import hexlify
+
def BeakerSessionFactoryConfig(**options):
""" Return a Pyramid session factory using Beaker session settings
supplied directly as ``**options``"""
@@ -79,7 +81,7 @@ def peek_flash(self, queue=''):
# CSRF API methods
def new_csrf_token(self):
- token = os.urandom(20).encode('hex')
+ token = hexlify(os.urandom(20))
self['_csrft_'] = token
return token
@@ -157,7 +159,7 @@ def set_cache_regions_from_settings(settings):
}
region_prefix = '%s.' % region
region_len = len(region_prefix)
- for key in cache_settings.keys():
+ for key in list(cache_settings.keys()):
if key.startswith(region_prefix):
region_settings[key[region_len:]] = cache_settings.pop(key)
coerce_cache_params(region_settings)

0 comments on commit 97b2c8a

Please sign in to comment.