>
> How can I get at a widget's template text.  I first tried
> TableForm.template, but it's a type, not a string.  Lovely metaclass
> black magic.
>
> I'm trying to create a slightly varied TableForm, but I want to build
> on the existing template so when it's changed or updated, my variant is
> updated also.  Something like this:
>
> class MyTableForm(TableForm):
>     template = "<a href="">blah</a><br />" + TableForm.template
>
> Of course this doesn't work.  Any ideas?
>
> Randall
>
>

Hi Randall,

cls.template get's compiled when the class is created (yeah, lovely
metaclass black magic ;), which means its a kid.Template instance once the
class is loaded. Right now there's no way to do what you want (maybe
digging into the Template instance's kid internals, I dunno..., however,
it would be ver hackish)

RFC:

Maybe whe should save the original template string at cls.template and a
compiled version at cls._template_c, with a property that transparently
compiles the string into the private attribute every time it's set? (for
faster display, etc...)

Alberto



Reply via email to