Skip to content

Commit

Permalink
little changes for compatibility with python3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jellonek committed Mar 9, 2012
1 parent 465b4bb commit 97b2c8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyramid_beaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``"""
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 97b2c8a

Please sign in to comment.