Wait! Before you shoot yourself on the foot (or someplace worst ;).

I've just found out that mytemplate should be an already compiled template. This is because the widget __metaclass__ compiles the template when classes are initiialized, not when instances are. You can override the template as I told you, but make sure:

repr(mytemplate) prints something like:

<turbogears.widgets.newforms.ListForm.Template.Template object at 0x17769d0>

RFC:

How about fixing the widget constructor so it does this automatically for us?? I think it would be a good idea as users would normally override templates with a string, not an already compiled template...

I can write a patch as soon as i get a green light as I've booked myself exclusively for TG development/testing today ;)

Alberto

On Feb 6, 2006, at 12:44 PM, Jorge Godoy wrote:


Alberto Valverde <[EMAIL PROTECTED]> writes:

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

This helps. I'll see what I can come up with for DataGrid here. Thanks.

--
Jorge Godoy      <[EMAIL PROTECTED]>

Reply via email to