in with the new. i have the bits in places where i think they should be, now i just need to work on the import scheme layout

This commit is contained in:
Justin Quick 2010-07-02 14:20:58 -04:00
parent ee16a68bbd
commit d0dc89ea80
8 changed files with 1574 additions and 0 deletions

28
flask/session.py Normal file
View file

@ -0,0 +1,28 @@
class Session(SecureCookie):
"""Expands the session with support for switching between permanent
and non-permanent sessions.
"""
def _get_permanent(self):
return self.get('_permanent', False)
def _set_permanent(self, value):
self['_permanent'] = bool(value)
permanent = property(_get_permanent, _set_permanent)
del _get_permanent, _set_permanent
class _NullSession(Session):
"""Class used to generate nicer error messages if sessions are not
available. Will still allow read-only access to the empty session
but fail on setting.
"""
def _fail(self, *args, **kwargs):
raise RuntimeError('the session is unavailable because no secret '
'key was set. Set the secret_key on the '
'application to something unique and secret')
__setitem__ = __delitem__ = clear = pop = popitem = \
update = setdefault = _fail
del _fail