Skip to content

Instantly share code, notes, and snippets.

@jvanasco
Created February 19, 2014 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvanasco/9103419 to your computer and use it in GitHub Desktop.
Save jvanasco/9103419 to your computer and use it in GitHub Desktop.
better ISession interface
class ISession(IDict):
...
...
...
id = Attribute('String `id`')
cookie_name = Attribute('String `cookie_name`')
cookie_value_in = Attribute('String `cookie_value_in`')
cookie_value_out = Attribute('String `cookie_value_in`')
...
...
...
@implementer(ISession)
class CookieSession(dict):
...
...
def __init__(self, request):
...
...
self.cookie_name = cookie_name
...
...
## would need to handle id, cookie_value_in , cookie_value_out
def BeakerSessionFactoryConfig(**options):
""" Return a Pyramid session factory using Beaker session settings
supplied directly as ``**options``"""
class PyramidBeakerSessionObject(SessionObject):
...
...
...
...
@property
def id(self):
return self._session().id
@property
def cookie_name(self):
return self.key
@property
def cookie_value_in(self):
return self.id
@property
def cookie_value_out(self):
return self.id
...
...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment