notifications

Notifications are the messages raised by the Mobyle system, the Mobyle administrator or one of the project members. Notifications are stored in the database and can be read/managed in the notification center. According to the preferences, messages will also be sent via one or more channels (email, ...), according to their type.

Project members can only create project notifications.

Notification sending requires the setup of the mail gateway in the MobyleConfig configuration.

mobyleConfig API reference

class mobyle.common.notifications.Notification(doc=None, gen_skel=True, collection=None, lang='en', fallback_lang='en', schema_2_restore=None)[source]

User notifications

bind_form(request)

Binds a request dictionnary to the object

Parameters:request (list) – request.params.items() in the form [ (key1,value1), (key1,value2), (key2,value1), ...]
Returns:list of fields in error
classmethod get_display_list_fields(klass)

Get the list of fields to display for a list

Returns:dict
classmethod get_renderer(klass, name)

Gets the renderer for an object attribute

notify()[source]

Send notification to user according to its preferences

Returns:True is notification sent, False if an error occured.
render(fields=None)

Render in HTML form an object

param: fields List of fields to show type: list rparam: HTML form rtype: str

Render in HTML a search form an object

param: fields List of fields to show, limited to first level of document type: list rparam: HTML form rtype: str

static renderer(klass, attr_name, attr, parent='')

Gets a renderer for an attribute

Parameters:
  • attr_name (str) – name of the attribute
  • attr (object) – attribute of the object
Returns:

selected renderer

classmethod search_by(klass, field)

In REST requests, search element by field instead of _id. Field must be a unique identifier. For the moment, this method

works only on primary attributes, not sub attributes of the object.

..TODO: manage sub attributes

Parameters:field (str) – Field name to use as key in search
sendMail(emails=[])[source]

Send notification by email

classmethod set_display_fields(klass, fields)

Sets the fields to be displayed, and in which order

param: fields List of fields to show type: list

classmethod set_display_list_fields(klass, fields)

Sets the fields to be displayed for lists, and in which order Defaults to all fields (first level only) param: fields List of fields to show type: list

classmethod set_renderer(klass, name, renderer)

Sets the renderer for an object attribute

user_wants_notif(user, notif_mean, notif_type)[source]

Checks user preferences to get a notification

Parameters:
  • user (User) – User to check
  • notif_mean (basestring) – Notif to use (mail)
  • notif_type (int) – Type of notif (project, data, ...)
Returns:

bool