Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


CSRF token must be decoded into a unicode object. #12

merged 1 commit into from

2 participants


No description provided.

@mcdonc mcdonc merged commit be7cd22 into from


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 25, 2012
  1. @nandoflorestan
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 pyramid_beaker/
8 pyramid_beaker/
@@ -11,6 +11,7 @@
from binascii import hexlify
def BeakerSessionFactoryConfig(**options):
""" Return a Pyramid session factory using Beaker session settings
supplied directly as ``**options``"""
@@ -18,6 +19,7 @@ def BeakerSessionFactoryConfig(**options):
class PyramidBeakerSessionObject(SessionObject):
_options = options
_cookie_on_exception = _options.pop('cookie_on_exception', True)
def __init__(self, request):
SessionObject.__init__(self, request.environ, **self._options)
def session_callback(request, response):
@@ -80,7 +82,7 @@ def peek_flash(self, queue=''):
# CSRF API methods
def new_csrf_token(self):
- token = hexlify(os.urandom(20))
+ token = hexlify(os.urandom(20)).decode('ascii')
self['_csrft_'] = token
return token
@@ -126,11 +128,11 @@ def session_factory_from_settings(settings):
def set_cache_regions_from_settings(settings):
""" Add cache support to the Pylons application.
The ``settings`` passed to the configurator are used to setup
the cache options. Cache options in the settings should start
with either 'beaker.cache.' or 'cache.'.
cache_settings = {'regions':None}
for key in settings.keys():
Something went wrong with that request. Please try again.