Christian Boos
2017-01-12 16:31:33 UTC
Hello everybody,
I took some steps to finalize my migration of Trac to the Jinja2
template engine, and the results are now visible in several places.
The latest code is in the jinja2-trunk-r15341 branch:
https://svn.edgewall.org/git/trac/devs/cboos
https://github.com/cboos/trac.git
A demo instance is available:
https://trac.edgewall.org/testing
(this one also contains my wiki-restyling changes, for good measure)
The #12649 ticket can be used to report trivial issues you'd find with
Jinja2 (#12640 for the restyling ones). Don't hesitate to create new
tickets for more serious issues, if any.
It would be nice to get some feedback at this point. You can contribute
by either reviewing the code, or simply by playing around in
t.e.o/testing and report any glitches you'd find there.
If you have any questions, the mailing list would probably be more
appropriate. Be sure to first go through the following wiki pages, as
they may already contain the answer you're looking for:
- https://trac.edgewall.org/wiki/TracDev/Proposals/Jinja
- https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja
Known "issues" so far:
- the branch keeps Genshi templates and Jinja2 templates side by side
(e.g. search.html and jsearch.html); that was helpful during the
development, and can still be useful while reviewing the branch, but I'm
going to go back to the original names soon (jsearch.html ->
search.html), moving a step closer to the merge.
- I haven't tested the i18n support for Jinja2 templates in plugins
yet; this is what I'm going to work on next
Also, I want to address the concerns raised last year about the backward
compatibility with Genshi. I propose to use the whole 1.4.x series as a
transition period, during which both template engines will be supported.
The plugins making use of Genshi templates won't need to be changed a
bit, while those which want to port to or start using Jinja2 templates
will have to use a new API: `IRequestHandler.process_request` methods
will have to return a `(template, data)` pair instead of the legacy
`(template, data, None)` triple. There's slightly more to it than this,
but you get the idea.
I've also taken into account the plugins which inject content in
generated pages via the ITemplateStreamFilter interface. That way is
deprecated in favor of using JavaScript for that purpose, but the
interface will nevertheless be supported during the transition period as
well.
One problem is that this ITemplateStreamFilter support mostly works, but
is not perfect, and of course kills most of the speed improvement
brought by the switch to Jinja2. Consider this as an incentive to
migrate such plugins! If people are really motivated to fix/enhance this
aspect, feel free to do so, but I feel it's somewhat counter-productive
to invest more energy there.
I hope we can soon finalize the integration of this effort, before we
make more serious moves on the Python3 topic (also, Jinja2 brings in six
as a dependency).
-- Christian
I took some steps to finalize my migration of Trac to the Jinja2
template engine, and the results are now visible in several places.
The latest code is in the jinja2-trunk-r15341 branch:
https://svn.edgewall.org/git/trac/devs/cboos
https://github.com/cboos/trac.git
A demo instance is available:
https://trac.edgewall.org/testing
(this one also contains my wiki-restyling changes, for good measure)
The #12649 ticket can be used to report trivial issues you'd find with
Jinja2 (#12640 for the restyling ones). Don't hesitate to create new
tickets for more serious issues, if any.
It would be nice to get some feedback at this point. You can contribute
by either reviewing the code, or simply by playing around in
t.e.o/testing and report any glitches you'd find there.
If you have any questions, the mailing list would probably be more
appropriate. Be sure to first go through the following wiki pages, as
they may already contain the answer you're looking for:
- https://trac.edgewall.org/wiki/TracDev/Proposals/Jinja
- https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja
Known "issues" so far:
- the branch keeps Genshi templates and Jinja2 templates side by side
(e.g. search.html and jsearch.html); that was helpful during the
development, and can still be useful while reviewing the branch, but I'm
going to go back to the original names soon (jsearch.html ->
search.html), moving a step closer to the merge.
- I haven't tested the i18n support for Jinja2 templates in plugins
yet; this is what I'm going to work on next
Also, I want to address the concerns raised last year about the backward
compatibility with Genshi. I propose to use the whole 1.4.x series as a
transition period, during which both template engines will be supported.
The plugins making use of Genshi templates won't need to be changed a
bit, while those which want to port to or start using Jinja2 templates
will have to use a new API: `IRequestHandler.process_request` methods
will have to return a `(template, data)` pair instead of the legacy
`(template, data, None)` triple. There's slightly more to it than this,
but you get the idea.
I've also taken into account the plugins which inject content in
generated pages via the ITemplateStreamFilter interface. That way is
deprecated in favor of using JavaScript for that purpose, but the
interface will nevertheless be supported during the transition period as
well.
One problem is that this ITemplateStreamFilter support mostly works, but
is not perfect, and of course kills most of the speed improvement
brought by the switch to Jinja2. Consider this as an incentive to
migrate such plugins! If people are really motivated to fix/enhance this
aspect, feel free to do so, but I feel it's somewhat counter-productive
to invest more energy there.
I hope we can soon finalize the integration of this effort, before we
make more serious moves on the Python3 topic (also, Jinja2 brings in six
as a dependency).
-- Christian
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.