Changes between Version 5 and Version 6 of S3/Notifications
- Timestamp:
- 09/05/13 10:45:21 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/Notifications
v5 v6 25 25 26 26 A 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 27 28 == Notifications == 28 29 … … 44 45 === Framework === 45 46 47 All parts of the notifications framework are implemented as S3Notifications class in modules/s3/s3notify.py. 48 49 To 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 46 51 Notifications require a scheduler worker process to run in the background. 52 53 === Message Templates === 54 55 Rendering of notification messages happens in two phases: 56 57 - Pre-rendering using a hook function 58 - Rendering via web2py view templates (message templates) 59 60 The 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 62 The message templates are web2py view templates stored in private/template/XYZ/views/msg (falling back to views/msg). 63 64 Template names use a prefix (default: "notify"), and the notification method name, like: notify_email.html (=template for email notifications). 65 66 Message 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 68 The template name prefix can be configured per resource (using the "notify_template" setting), the default is "notify". 69 70 Any deployment-template-specific message template (including fallbacks) is preferred over any default templates. 47 71 48 72 === Configuration === … … 50 74 ==== Per Deployment ==== 51 75 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 52 83 ==== Per Resource ==== 53 84 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