Package Products :: Package ZenWidgets :: Module messaging :: Class MessageSender |
[hide private]
[frames] | no frames]

# Class MessageSender

source code

    object --+
             |
            MessageSender

Known Subclasses:
  - ScriptMessageSender

Adapts persistent objects in order to provide message sending capability.

Instance Methods | [hide private]
__init__(self, context) Initialization method. | source code
sendToBrowser(self, title, body, priority=INFO, image=None) Create a message and store it on the session object. | source code
sendToUser(self, title, body, priority=INFO, image=None, user=None) Create a message and store it in the IMessageQueue of the user specified. | source code
sendToAll(self, title, body, priority=INFO, image=None) For eash user in the system, create an identical message and store it in the user's IMessageQueue. | source code

Method Details | [hide private]

### __init__(self, context) (Constructor) | source code
Initialization method. Parameters: `context` (Persistent) - The object being adapted. Must have access to the dmd and the current request object via acquisition. Overrides: object.__init__

### sendToBrowser(self, title, body, priority=INFO, image=None) | source code
Create a message and store it on the session object. Parameters: `title` (str) - The message title `body` (str) - The body of the message `priority` (int) - Message priority; one of INFO, WARNING, CRITICAL `image` (str) - Optional URL of an image to be displayed in the message

### sendToUser(self, title, body, priority=INFO, image=None, user=None) | source code
Create a message and store it in the IMessageQueue of the user specified. If no user is specified, use the queue of the current user. Parameters: `title` (str) - The message title `body` (str) - The body of the message `priority` (int) - Message priority; one of INFO, WARNING, CRITICAL `image` (str) - Optional URL of an image to be displayed in the message `user` (str) - Optional username corresponding to the queue to which messages should be sent. If left as `None`, the current user's queue will be used.

### sendToAll(self, title, body, priority=INFO, image=None) | source code
For eash user in the system, create an identical message and store it in the user's IMessageQueue. Parameters: `title` (str) - The message title `body` (str) - The body of the message `priority` (int) - Message priority; one of INFO, WARNING, CRITICAL `image` (str) - Optional URL of an image to be displayed in the message