Anton2 wrote:
> But the path I'm taking now seems very awkward, so I hope that there is
> better option ...

Hi Anton2,

To replace the template of any widget, you have two options:

1) Sub-class the widget and set the class variable "templates" to
either the HTML of the template or to something like
"myproject.templates.text_widget".  THe the second case it will use a
template file just like expose does.

2) When you instantiate a widget, you can pass the "template=" keyword
argument with values like in (1).  It basically overrides whatever is
defined in teh class.

(You can even mix the two methods.  You could subclass to set a new
default and then user the template keyword argument to override in
certain special circumstances.)

A final note: you can also overide / set default validators by
subclassing too.

It too me a while to figure all this out the first time. I had to read
the source to fully understand the widgets declarative style and
apecial attributes.  (heck, formencode still confuses me!) (c:

Anyway, I hope this helps.

Krys


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to