Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Handle case where SignedCookieSessionFactory is not available.
  • Loading branch information
Preston-Landers committed Jul 24, 2017
commit 46889a0947694d752b210f7a2909db56ffe1ec2b
9 changes: 5 additions & 4 deletions velruse/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def default_setup(config):
specified then an in-memory storage backend will be used.

"""
# from pyramid.session import UnencryptedCookieSessionFactoryConfig
from pyramid.session import SignedCookieSessionFactory
try:
from pyramid.session import SignedCookieSessionFactory as SessionFactory
except ImportError:
from pyramid.session import UnencryptedCookieSessionFactoryConfig as SessionFactory

log.info('Using an unencrypted cookie-based session. This can be '
'changed by pointing the "velruse.setup" setting at a different '
Expand All @@ -102,8 +104,7 @@ def default_setup(config):
else:
secret = ''.join('%02x' % x for x in os.urandom(16))
log.info('autogenerated session secret: %s', secret)
factory = SignedCookieSessionFactory(
secret, cookie_name=cookie_name)
factory = SessionFactory(secret, cookie_name=cookie_name)
config.set_session_factory(factory)

# setup backing storage
Expand Down