On Feb 6, 2006, at 11:59 AM, Lee McFadden wrote:

You could just create an instance and overwrite the .template
attribute.  Just copy/paste the template into your controller from the
widget's source, instanciate the widget and then assign your modified
template to widget_instance.template.

Unless the new api forbids this (which afaik it doesn't) that should
be all you need to do using a py:if in the template to display the
image.

Lee

No, you cannot do that! The new API explicitly forbids changing widget attributres once the widget is initialized. You can, however, override the template when you initialize your widget:

Bad:
widget = widgets.TextField()
widget.template = mytemplate
ValueError: It is not threadsafe to modify widgets in a request

Good:
widget = widgets.TextField(template=mytemplate)
asset widget.template == mytemplate

Hoope it helps,
Alberto

Reply via email to