ploneintranet.notifications package

Submodules

ploneintranet.notifications.channel module

class ploneintranet.notifications.channel.AllChannel(userid)

Bases: object

get_all_messages(limit=None, keep_unread=False)
get_unread_count()
get_unread_messages(keep_unread=False)

ploneintranet.notifications.interfaces module

interface ploneintranet.notifications.interfaces.IChannel

Bases: zope.interface.Interface

Represents an access to message queues for consumption. It is responsible to filtering the message queue so that not all types of messages are being shown. It is also responsible for updating the read flags as required. To add messages, use a MessageClassHandler

If you need unfiltered access, use ploneintranet.notifications.channel.AllChannel

get_unread_messages(keep_unread=False)

Return the unread messages, filtered for messages this Channel would return anyway. By default, this will also mark the messages as read. You can change this behavior by setting keep_unread to True

get_unread_count()

Return the unread message count, filtered for messages this Channel would return anyway

get_all_messages()

Return read and unread messages, filtered for messages this Channel would not return anyway You can limit the number of messages to return with the limit argument

interface ploneintranet.notifications.interfaces.IMessage

Bases: zope.interface.Interface

Represents a Notification Message for a specific userw

marked_read_as()

Return when the message has been read as an utc time stamp

update_actors(added=[], removed=[])

Update the actors list

update_object(obj)

Update the object. Forces an update of the message_last_modification_date which is stored on the object

mark_as_read(now=None)

Mark the message as read. if now is provided, it is assumed as an utc timestamp and stored

clone()

Return a clone of the message

is_unread()

Return whether the message is unread

interface ploneintranet.notifications.interfaces.IMessageClassHandler

Bases: zope.interface.Interface

Represents a handler that creates message for each user who should get them. Does not handle message access, does not manage, where to show the message. Since this is an expensive operation, this handler API might change in the future to facilitate batching or asynchronous handling. Nothing official so far though It is the MessageClassHandler responsability to only look for messages it is really responsible for.

add(message)

Add a message to each user who should get the message. The message gets cloned

cleanup()

Checks for each user if relevant messages should be deleted

interface ploneintranet.notifications.interfaces.IMessageFactory

Bases: zope.interface.Interface

Creates a message

interface ploneintranet.notifications.interfaces.INotifiable

Bases: zope.interface.Interface

Interface applied to objects that should be notified

interface ploneintranet.notifications.interfaces.INotificationsQueues

Bases: zope.interface.Interface

Stores queues for notifications for each user. Queues are implemented with PersistentLists and can be modified in place. On first request for users not having queues yet, an empty queue gets generated automatically. You interact with queues via Channels and MessageClassHandlers

get_user_queue(userid)

Get a queue for given user object. Create and return a new persistent queue if user did not have a queue yet.

del_user_queue(userid)

Delete the queue for the given user object.

clear()

Empty all queues

append_to_user_queue(userid, value)

Append value to the given userid queue

interface ploneintranet.notifications.interfaces.INotificationsTool

Bases: zope.interface.Interface

Provide INotificationsQueue as a site utility For package internal use only

ploneintranet.notifications.message module

class ploneintranet.notifications.message.Message(actors, predicate, obj)

Bases: persistent.Persistent

actors = None
clone()
date
is_unread()
mark_as_read(now=None)
marked_read_at()
obj = {}
predicate = ''
update_actors(added=[], removed=[])
update_object(obj)
verb

ploneintranet.notifications.queue module

class ploneintranet.notifications.queue.AppendableLOBTree

Bases: BTrees.LOBTree.LOBTree

Implement append to LOBtrees to make it work like lists

append(value)

We append to the LOBtree value generating a key based on the current time

as_tuple(limit=None)

Return the values as a tuple.

class ploneintranet.notifications.queue.Queues(context=None)

Bases: persistent.Persistent, ExplicitAcquirer

Stores queues for each user. Users are referenced as string userids.

Return values are BTrees.OOBTree.OOTreeSet iterables.

append_to_user_queue(userid, value)
clear()
del_user_queue(userid)
get_user_queue(userid, limit=None)

ploneintranet.notifications.testing module

ploneintranet.notifications.tool module

class ploneintranet.notifications.tool.NotificationsTool(context=None)

Bases: Products.CMFCore.utils.UniqueObject, OFS.SimpleItem.SimpleItem, ploneintranet.notifications.queue.Queues

Provide INetworkContainer as a site utility.

id = 'ploneintranet_notifications'
meta_type = 'ploneintranet.notifications tool'

Module contents