Edgewall Software

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


Ignore:
Timestamp:
Oct 20, 2013, 10:03:12 AM (11 years ago)
Author:
Peter Suter
Comment:

More questions and possible solutions

Legend:

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

    v3 v4  
    7070Maybe `styles()` should be changed to enumerate the supported style / transport / realm combinations as tuples:
    7171{{{#!python
    72     def styles(self):
     72    def get_supported_styles(self):
    7373        yield ('text/plain', 'sms', 'ticket')
    7474}}}
     
    8484* Define the interface with ''two methods''. One method with parameters as before; another method without parameters must list all supported styles for any transport or realm.
    8585* Define the interface with one method, with ''optional parameters''. If the parameters are `None` the method must list all supported styles for any transport or realm.
     86* Introduce a mechanism similar to `IAnnouncementProducer.realms()` that enumerates all supported realms. Iterating over all possible realm / transport combinations then gets a complete list of supported styles.
    8687
    87 Similary, could some formatters want to support all realms?
     88Similary, could some formatters want to support all realms? If not, another possible solution could be to keep the `transport` parameter, but not the `realm` parameter:
     89{{{#!python
     90    def get_supported_styles(self, transport):
     91        if transport == 'sms':
     92            yield ('text/plain', 'ticket')
     93}}}
     94This solves the immediate problem for listing the supported styles per transport. (But does not help if in the future we want to allow the user to selected his preferred style per realm-specific rule.)
    8895
    8996The chosen solution should be simple and easy to implement correctly by plugin authors.
     97
     98=== Quality level?
     99Other 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:
     100{{{#!python
     101    def get_supported_styles(self):
     102        yield ('text/plain', 'sms', 'ticket', 8)
     103}}}