Changes between Version 4 and Version 5 of TracDev/Proposals/AdvancedNotification/INotificationFormatter
- Timestamp:
- Oct 27, 2013, 12:23:19 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/Proposals/AdvancedNotification/INotificationFormatter
v4 v5 14 14 Implementing the interface follows the standard guidelines found in [wiki:TracDev/ComponentArchitecture] and of course [wiki:TracDev/PluginDevelopment]. 15 15 16 A simple ` styles()` method lists the supported MIME types for a given transport and event realm.16 A simple `get_supported_styles()` method lists the supported MIME types and event realms for a given transport. 17 17 18 18 The `format()` method formats a notification event. It receives the following parameters: 19 19 * `transport`: The name of the transports that should be used. (See [wiki:INotificationDistributor INotificationDistributor]) 20 * `style`: The style that should be used. One of those returned by ` styles()`.20 * `style`: The style that should be used. One of those returned by `get_supported_styles()`. 21 21 * `event`: A `trac.notification.api.NotificationEvent` instance describing the event about which the recipients should be notified. 22 22 … … 37 37 # INotificationFormatter methods 38 38 39 def styles(self, transport, realm):40 if transport == 'sms' and realm == 'ticket':41 yield 'text/plain'39 def get_supported_styles(self, transport): 40 if transport == 'sms': 41 yield ('text/plain', 'ticket') 42 42 43 43 def format(self, transport, style, event): … … 64 64 * DONE Dropped the `alternative_style_for()` method. (The distributor can select fallbacks without this.) 65 65 * DONE Dropped the `realm` parameter to the `format()` method. (Use `event.realm` instead.) 66 * DONE Switched from `styles(transport, realm)` to `get_supported_styles(transport)` (See [#Enumerateallstyles below]) 66 67 67 68 == Open questions … … 96 97 The chosen solution should be simple and easy to implement correctly by plugin authors. 97 98 99 DONE This was implemented in changeset:ac2132adf2c0/psuter 100 98 101 === Quality level? 99 102 Other extension points that enumerate supported cases (e.g. IRepositoryConnector, IHTMLPreviewRenderer, IContentConverter and IDatabaseConnector) also return some kind of ''quality level''. Should something like this be added: