Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1355 (closed enhancement: fixed)

Opened 10 years ago

Last modified 10 years ago

[PATCH] Widgets automatically call ET() in Genshi templates

Reported by: paj Owned by: anonymous
Priority: normal Milestone: 1.5
Component: TG Widgets Version: 1.0
Severity: normal Keywords:
Cc:

Description

At the moment, if you are using TGWidgets and Genshi templates you have to surround all widgets with ET(). This patch makes the ET() calls automatically. It maintains compatibility with kid and nested widgets, by storing state in cherrypy.request.

The patch only solves this specific problem. It does not allow you to use Genshi templates inside TGWidgets.

The main problem with the patch is that if you do call ET() now, you get an error. Fixing that would probably require a change to Genshi, or some very dodgy monkeypatching. Also, this requires Genshi 0.4.

Attachments

genshi-auto-et.patch Download (2.2 KB) - added by paj 10 years ago.
genshi-auto-et2.patch Download (3.0 KB) - added by paj 10 years ago.
Second version

Change History

Changed 10 years ago by paj

comment:1 Changed 10 years ago by alberto

  • Priority changed from high to normal
  • Milestone changed from __unclassified__ to 1.1
  • Summary changed from Widgets automatically call ET() in Genshi templates to [PATCH] Widgets automatically call ET() in Genshi templates

Patch looks great! This will certainly go in for 1.1 since Genshi is planned to be the default template engine.

I'll apply it to the trunk as soon as I merge 1.0 widgets into 1.1 to remove the mess I made at [1875]

Thanks!

Alberto

FYI: TGwidgets are not planned to support genshi inside their templates, ToscaWidgets? already solve that problem and will be bundled with TG since 1.1. This patch will surely make teh transition and backwards compat. easier.

Changed 10 years ago by paj

Second version

comment:2 Changed 10 years ago by paj

I've just attached a second attempt. Now widgets calls can be wrapped in ET, or not, either works. The solution I've used is a bit hacky - bringing template-specific code into view/base.py. However, I can't really see a way round this, short of making changes to Genshi. And if we did that, it that could bring problems if people upgrade TurboGears but leave Genshi.

comment:3 Changed 10 years ago by paj

  • Status changed from new to closed
  • Resolution set to fixed

Ok, committed in [3455]

Note: See TracTickets for help on using tickets.