Changes between Version 20 and Version 21 of TracDev/ApiChanges/0.11
- Timestamp:
- Jul 25, 2007, 1:47:38 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/ApiChanges/0.11
v20 v21 2 2 = !TracDev/ApiChanges/0.11 = 3 3 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.''' 7 5 8 6 == Caveats for Plugin Developers == … … 13 11 == Migrating away from Clearsilver == 14 12 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].13 ClearSilver 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]. 16 14 17 15 The migration from ClearSilver to Genshi was done on trunk in r3832. … … 21 19 == Advanced JavaScript Support == 22 20 23 [http://jquery.org jQuery] 1.1.1is 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. 24 22 25 23 … … 35 33 == Interface Changes == 36 34 37 === `ITimelineEventProvider` ^[source:trunk/trac/timeline/api.py@head#L87 (0.11)] [source:tags/trac-0.10/trac/ timeline.py@head#L32 (0.10)]^ === #ITimelineEventProvider35 === `ITimelineEventProvider` ^[source:trunk/trac/timeline/api.py@head#L87 (0.11)] [source:tags/trac-0.10/trac/Timeline.py@head#L32 (0.10)]^ === #ITimelineEventProvider 38 36 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`. 37 First 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 41 try: 42 from trac.timeline import ITimelineEventProvider 43 except ImportError: 44 from trac.Timeline import ITimelineEventProvider 45 }}} 46 47 Also 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 51 def 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 }}} 40 58 41 59 Then, 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. 42 60 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 43 63 ''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 67 Similar 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 71 try: 72 from trac.search import ISearchSource 73 except ImportError: 74 from trac.Search import ISearchSource 75 }}} 44 76 45 77 === `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 … … 52 84 The context object provides the information about the Trac resource which "owns" the text being processed. 53 85 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]. 55 87 56 88 === `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 … … 77 109 * {{{webadmin.web_ui.IAdminPageProvider}}} -> {{{trac.admin.api.IAdminPanelProvider}}}. Also its {{{get_admin_pages}}} method became {{{get_admin_panels}}}. 78 110 * some module names, such as {{{trac.Timeline}}} and {{{trac.Search}}}, were de-capitalized, e.g. {{{trac.timeline}}} 79