Edgewall Software

Changes between Version 20 and Version 21 of TracDev/ApiChanges/0.11


Ignore:
Timestamp:
Jul 25, 2007, 1:47:38 PM (17 years ago)
Author:
Christopher Lenz
Comment:

Some additional notes about the timeline changes

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/ApiChanges/0.11

    v20 v21  
    22= !TracDev/ApiChanges/0.11 =
    33
    4 '''Note: Development of Trac [milestone:0.11] has started with r3804 and the trunk now uses ''[http://genshi.edgewall.org/ Genshi]'' instead of ClearSilver, for its template engine.
    5 Nevertheless, you should have in mind that the information in this page corresponds to a ''work in progress''.'''
    6 
     4'''Note: Development of Trac [milestone:0.11] has started with r3804 and the trunk now uses ''[http://genshi.edgewall.org/ Genshi]'' instead of ClearSilver, for its template engine. Please keep in mind that the information in this page is work in progress.'''
    75
    86== Caveats for Plugin Developers ==
     
    1311== Migrating away from Clearsilver ==
    1412
    15 ClearSilver has proven a bit uncomfortable to work with, and search for better alternatives were done a few months ago. The [http://kid-templating.org/ Kid] templating language was unanimously found appealing, to the point cmlenz did a porting of Trac to Kid, during the DrProject fork. This in turn was found painful, and prompted Christopher to start his own, enhanced, version of Kid currently maturing as [http://genshi.edgewall.org/ Genshi].
     13ClearSilver has proven too limited and “uncomfortable”, so research for better alternatives was done. The [http://kid-templating.org/ Kid] templating language was unanimously found appealing, to the point that ChristopherLenz did a port of Trac to Kid during the development of DrProject (a fork of Trac). This in turn was found painful, and prompted Christopher to start his own, enhanced, version of Kid currently maturing as [http://genshi.edgewall.org/ Genshi].
    1614
    1715The migration from ClearSilver to Genshi was done on trunk in r3832.
     
    2119== Advanced JavaScript Support ==
    2220
    23 [http://jquery.org jQuery] 1.1.1 is included in Trac, and it is advised to use this library when writing JavaScript code.
     21[http://jquery.org jQuery] is included in Trac, and it is advised to use this library when writing JavaScript code.
    2422
    2523
     
    3533== Interface Changes ==
    3634
    37 === `ITimelineEventProvider` ^[source:trunk/trac/timeline/api.py@head#L87 (0.11)] [source:tags/trac-0.10/trac/timeline.py@head#L32 (0.10)]^ === #ITimelineEventProvider
     35=== `ITimelineEventProvider` ^[source:trunk/trac/timeline/api.py@head#L87 (0.11)] [source:tags/trac-0.10/trac/Timeline.py@head#L32 (0.10)]^ === #ITimelineEventProvider
    3836
    39 First thing, the timeline module has now its own package (`trac.timeline`), so the ITimelineEventProvider interface itself should now be imported from `trac.timeline.api`.
     37First thing, the timeline module has now its own package (`trac.timeline`), and the ITimelineEventProvider interface itself should now be imported from `trac.timeline`. However, note that the case has changed here, as you would previously have imported `trac.Timeline`. If you want to support both versions, try something like this:
     38
     39{{{
     40#!python
     41try:
     42    from trac.timeline import ITimelineEventProvider
     43except ImportError:
     44    from trac.Timeline import ITimelineEventProvider
     45}}}
     46
     47Also note that the `start` and `stop` arguments to the `get_timeline_events` method are now `datetime` objects where they previously were floats/ints. Again, if you want to support both Trac 0.11 and previous versions, use something like the following code:
     48
     49{{{
     50#!python
     51def get_timeline_events(self, req, start, stop, filters):
     52    if isinstance(start, datetime): # Trac>=0.11
     53        from trac.util.datefmt import to_timestamp
     54        start = to_timestamp(start)
     55        stop = to_timestamp(stop)
     56    ...
     57}}}
    4058
    4159Then, the return type for the `get_timeline_events` event has changed. It can now be a `TimelineEvent` object instead of a tuple, though the tuple return value will still be supported for compatibility reasons in 0.11.
    4260
     61(Please note that this API hasn't been 100% agreed on yet, so you probably want to stick to just returning tuples for now.)
     62
    4363''Note: support for #1198 and #2293 will likely require adding other methods to that interface''
     64
     65=== `ISearchSource` ^[source:trunk/trac/search/api.py@head#L17 (0.11)] [source:tags/trac-0.10/trac/search.py@head#L30 (0.10)]^ === #ISearchSource
     66
     67Similar to the timeline package, the search module has also been migrated to a package (`trac.search`), with the same case change. Again, if you want to support both versions, try something like this:
     68
     69{{{
     70#!python
     71try:
     72    from trac.search import ISearchSource
     73except ImportError:
     74    from trac.Search import ISearchSource
     75}}}
    4476
    4577=== `IWikiMacroProvider` ^[source:trunk/trac/wiki/api.py@head#L73 (0.11)] [source:tags/trac-0.10/trac/wiki/api.py@head#L70 (0.10)]^ === #IWikiMacroProvider
     
    5284The context object provides the information about the Trac resource which "owns" the text being processed.
    5385
    54 `render_macro(req, name, content)` will removed in [milestone:0.12].
     86`render_macro(req, name, content)` will likely be removed in [milestone:0.12].
    5587
    5688=== `IHTMLPreviewRenderer` ^[source:trunk/trac/wiki/api.py@head#L213 (0.11)] [source:tags/trac-0.10/trac/wiki/api.py@head#L209 (0.10)]^ === #IHTMLPreviewRenderer
     
    77109 * {{{webadmin.web_ui.IAdminPageProvider}}} -> {{{trac.admin.api.IAdminPanelProvider}}}.  Also its {{{get_admin_pages}}} method became {{{get_admin_panels}}}.
    78110 * some module names, such as {{{trac.Timeline}}} and {{{trac.Search}}}, were de-capitalized, e.g. {{{trac.timeline}}}
    79