Changes between Version 5 and Version 6 of S3/Notifications


Ignore:
Timestamp:
09/05/13 10:45:21 (11 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/Notifications

    v5 v6  
    2525
    2626A custom interface can be found in private/templates/DRMP/controllers.py. This interface manages a single subscription per user with multiple resources using a common filter.
     27
    2728== Notifications ==
    2829
     
    4445=== Framework ===
    4546
     47All parts of the notifications framework are implemented as S3Notifications class in modules/s3/s3notify.py.
     48
     49To impersonate the subscriber for send(), the S3Notifications.notify() sends a temporary, single-use auth token together with the POST request. This auth token is handled in models/00_utils.py.
     50
    4651Notifications require a scheduler worker process to run in the background.
     52
     53=== Message Templates ===
     54
     55Rendering of notification messages happens in two phases:
     56
     57  - Pre-rendering using a hook function
     58  - Rendering via web2py view templates (message templates)
     59
     60The pre-rendering is to convert the extracted data into a suitable format for the message template. The pre-rendering routine is configurable both per deployment-template and per resource (resource-specific overrides deployment-specific), the default pre-renderer is S3Notifications._render().
     61
     62The message templates are web2py view templates stored in private/template/XYZ/views/msg (falling back to views/msg).
     63
     64Template names use a prefix (default: "notify"), and the notification method name, like: notify_email.html (=template for email notifications).
     65
     66Message templates for EMAIL can further use a format suffix "html" or "text" (e.g. "notify_email_html.html") - where both fall back to the name without suffix.
     67
     68The template name prefix can be configured per resource (using the "notify_template" setting), the default is "notify".
     69
     70Any deployment-template-specific message template (including fallbacks) is preferred over any default templates.
    4771
    4872=== Configuration ===
     
    5074==== Per Deployment ====
    5175
     76  - ''in private/templates/XYZ/config.py or 000_config.py''
     77
     78||'''Setting'''||'''Explanation'''||
     79||settings.msg.notify_renderer||Pre-renderer function, render(resource, data, meta_data, format=None)||
     80||settings.msg.notify_subject||Template for the subject line of notification emails||
     81||settings.msg.notify_email_format||Preferred email format (can be overridden per subscription) - "html" or "text"||
     82
    5283==== Per Resource ====
    5384
    54 ==== Per Subscription ====
    55 == Notifications ==
     85||'''Setting'''||'''Explanation'''||
     86||notify_fields||Fields to extract for notification emails (like list_fields)||
     87||notify_renderer||Pre-renderer function, see settings.msg.notify_renderer||
     88
     89----
     90- [wiki:S3 S3 API Guide]
     91- DeveloperGuidelines