Edgewall Software

Changes between Version 4 and Version 5 of TracDev/Proposals/AdvancedNotification/INotificationFormatter


Ignore:
Timestamp:
Oct 27, 2013, 12:23:19 PM (11 years ago)
Author:
Peter Suter
Comment:

Note change to get_supported_styles()

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/Proposals/AdvancedNotification/INotificationFormatter

    v4 v5  
    1414Implementing the interface follows the standard guidelines found in [wiki:TracDev/ComponentArchitecture] and of course [wiki:TracDev/PluginDevelopment].
    1515
    16 A simple `styles()` method lists the supported MIME types for a given transport and event realm.
     16A simple `get_supported_styles()` method lists the supported MIME types and event realms for a given transport.
    1717
    1818The `format()` method formats a notification event. It receives the following parameters:
    1919* `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()`.
    2121* `event`: A `trac.notification.api.NotificationEvent` instance describing the event about which the recipients should be notified.
    2222
     
    3737    # INotificationFormatter methods
    3838   
    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')
    4242
    4343    def format(self, transport, style, event):
     
    6464   * DONE Dropped the `alternative_style_for()` method. (The distributor can select fallbacks without this.)
    6565   * 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])
    6667
    6768== Open questions
     
    9697The chosen solution should be simple and easy to implement correctly by plugin authors.
    9798
     99DONE This was implemented in changeset:ac2132adf2c0/psuter
     100
    98101=== Quality level?
    99102Other 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: