Edgewall Software

Version 11 (modified by Christian Boos, 17 years ago) ( diff )

Note about API change for IWikiMacroProvider introduced by r4451.

TracDev/ApiChanges/0.11

Note: Development of Trac 0.11 has started with r3804 and the trunk now uses Genshi instead of ClearSilver, for its template engine. Nevertheless, you should have in mind that the information in this page corresponds to a work in progress.

Migrating away from Clearsilver

ClearSilver has proven a bit uncomfortable to work with, and search for better alternatives were done a few months ago. The 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 Genshi.

The migration from ClearSilver to Genshi was done on trunk in r3832.

You can start porting your plugins from Clearsilver to Genshi.

Date and Time Manipulations

Since r3935, Trac uses datetime objects internally, instead of timestamps. More precisely, the database layer still uses int timestamps, but manipulation of time values is now done on datetime objects as soon as possible, see e.g. the Timeline module.

Those datetime values are directly added by the controllers to the data model, and it's the responsibility of the templates to pick up the appropriate time representation, using one of the built-in date formatting utilities: format_date, format_datetime, format_datetime, http_date, pretty_timedelta (see chrome.py), or even the $dateinfo() macro.

Those utilities automatically take into account the timezone information set by the user, so that the dates are presented in a meaningful way to him.

Interface Changes

IWikiMacroProvider (0.11) (0.10)

render_macro(req, name, content) is now render_macro(formatter, name, content).

The req was not enough for most of the macros, which needed to resort to various hacks to get more information about the formatting at work. The more adequate formatter object is now provided instead. The req object can still be obtained from the formatter, with formatter.req. Better yet, the formatter now always know about the WikiContext in which it operates (use formatter.context to retrieve it). The context object provides the information about the Trac resource which "owns" the text being processed.

IHTMLPreviewRenderer (0.11) (0.10)

Similar to the above change, render(req, mimetype ...) is now render(context, mimetype ...). It doesn't matter that much however, as it looks like that this interface is going to be integrated in IContentConverter anyway (see #3332).

Note: See TracWiki for help on using the wiki.