Classes: Session / Cookie Session / Flash / Event / Cache
Recent Updates
[4/28/2009]1.2.2
- cache - now will not error if a write to the datastore fails, continues with just memcache
- delete_item() added to session. Can be used to delete items, whether they exist or not
and not throw KeyError. Optionally you can call with throw_exception set to True, and it will
throw KeyError exceptions, as if you've done a "del session[key]"
[3/08/2009]1.2 Release
- cache - has_key method added
- sessions - Bug fix for empty sessions with null values sids being created along with new sessions
[2/20/2009]1.2 Release
- Bugfix: session deleting was failing and making it so that an error
would be presented on every pageview until cookies were cleared. This is
fixed.
- sessions.py - Cookie sessions are now in.
You can now initialize session as Session(writer="cookie") and all
session values will be stored in a new cookie within the browser,
bypassing the datastore altogether. If you are creating an application that
does not need to protect the session data, this will have huge CPU
benefits. Another user is to initialize cookie writer sessions for your
application's non-logged in users. When the user logs in you can reset the
session to the normal datastore backed one.
A new class method check_token() has been created to determine which type of
session is available to the user. Session.check_token() will check to see if a
session token cookie exists in the users browser, then will determine if it's
valid or not. Thus check_token allows you to do something like:
if Session.check_token():
session = Session()
else:
session = Session(writer="cookie")
The django middleware has been updated to use this. However, this does mean
you have an extra level of management necessary for your login
functionality for django now. This has only been tested on appenginepatch with
the latest django.
For example to log in a user you'd want to do something like this:
user = auth.authenticate(account = id)
if user is not None and user.is_active:
request.session.save()
auth.login(request, user)
[2/8/2009]1.1.3 Release
- session: bugfix to handle str() and len() methods when there is no session data. Issue #12
- session: delete_all_sessions changed to a class method. Issue #14 (NOTE: delete_all_sessions is not complete)
- session: Modified session token to include the session key. Issue #10
- session: Session token encryption changed to md5 from sha1, in order to improve performance as the salt is randomized with a time string.