Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (30 sloc) 1.26 KB
This module is the same as the sessions module, except that:
1. NotificationMixin sets a "notifications" property instead a "session" one,
and that the NotificationManager ("notifications") gets an object only once, and
deletes it from the database after retrieving;
2. The objects are stored in db 1 (for default) instead of 0 to avoid conflicts
with sessions. (You can change this setting with the "db_notifications" setting
in the "pycket_redis" setting.)
from pycket.session import create_mixin, SessionManager, SessionMixin
class NotificationManager(SessionManager):
DB = 1
DB_SETTING = 'db_notifications'
def get(self, name, default=None):
Retrieves the object with "name", like with SessionManager.get(), but
removes the object from the database after retrieval, so that it can be
retrieved only once
session_object = super(NotificationManager, self).get(name, default)
if session_object is not None:
return session_object
class NotificationMixin(object):
def notifications(self):
Returns a NotificationManager instance
return create_mixin(self, '__notification_manager', NotificationManager)
Jump to Line
Something went wrong with that request. Please try again.