Hi again,

This is the last RFC for today ;-)

Now that the context-refactoring branch is in trunk and that most ticket 
have a patch ready, this is the last big task remaining before the beta1.

In this refactoring, the TimelineEvent class is gone, and instead the 
ITimelineEventProvider.get_timeline_events() method has been changed to 
return a tuple that can contain "private" data which the provider will 
use in a second step in a ITimelineEventProvider.render_timeline_event() 
method. The advantage being that the rendering is done only when 
actually needed (some events might be skipped due to the limit 
parameter) and a great degree of flexibility about the presentation of 
the event is preserved.


Highlight on the interesting ITimelineEventProvider API changes:

    def get_timeline_events(req, start, stop, filters):
        """Return a list of events in the time range given by the 
`start` and
        `stop` parameters.

        The `filters` parameters is a list of the enabled filters, each item
        being the name of the tuples returned by `get_timeline_filters`.

        Since 0.11, the events are `(kind, date, author, data)` tuples,
        where `kind` is a string used for categorizing the event, `date`
        is a `datetime` object, `author` is a string and `data` is some
        private data that the component will reuse when rendering the event.

        When the event has been created indirectly by another module,
        like this happens when calling 
`AttachmentModule.get_timeline_events()`
        the tuple can also specify explicitly the provider by returning 
tuples
        of the following form: `(kind, date, author, data, provider)`.

        Before version 0.11,  the events returned by this function used to
        be tuples of the form `(kind, href, title, date, author, markup)`.
        This is still supported but less flexible, as `href`, `title` and
        `markup` are not context dependent.
        """

    def render_timeline_event(context, field, event):
        """Display the title of the event in the given context.

        :param context: the rendering `Context` object that can be used for
                        rendering
        :param field: what specific part information from the event should
                      be rendered: can be the 'title', the 'description' or
                      the 'url'
        :param event: the event tuple, as returned by `get_timeline_events`
        """


See r6141 for the full changeset.

Comments welcomed.


-- Christian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to