Skip to content

Commit

Permalink
added 'session_key', to allow alternates to the default 'beaker.sessi…
Browse files Browse the repository at this point in the history
…on', as supported in beaker, and necessary/useful for plugging multiple apps together (so that different apps can have distinct beaker sessions).
  • Loading branch information
Michael committed Mar 28, 2015
1 parent a9137d4 commit 109fc83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cork/cork.py
Expand Up @@ -55,7 +55,7 @@ class BaseCork(object):
"""Abstract class"""

def __init__(self, directory=None, backend=None, email_sender=None,
initialize=False, session_domain=None, smtp_server=None,
initialize=False, session_domain=None, session_key=None, smtp_server=None,
smtp_url='localhost'):
"""Auth/Authorization/Accounting class
Expand All @@ -71,6 +71,7 @@ def __init__(self, directory=None, backend=None, email_sender=None,
self.mailer = Mailer(email_sender, smtp_url)
self.password_reset_timeout = 3600 * 24
self.session_domain = session_domain
self.session_key = session_key or 'beaker.session'
self.preferred_hashing_algorithm = 'PBKDF2'

# Setup JsonBackend by default for backward compatibility.
Expand Down Expand Up @@ -748,7 +749,7 @@ def _redirect(location):
@property
def _beaker_session(self):
"""Get Beaker session"""
return bottle.request.environ.get('beaker.session')
return bottle.request.environ.get(self.session_key)

def _save_session(self):
self._beaker_session.save()
Expand Down

0 comments on commit 109fc83

Please sign in to comment.