Michel Albert schrieb:
> Even though it's simple to figure out by reading the source code, I
> find that
> on could add a small section in the widget documentation how to load
> the
> template from a file. See also http://docs.turbogears.org/1.0/WidgetsOverview
> 
> The way I solve this task (example widget source):
> 
> # ----- Widget Source
> --------------------------------------------------------
> from turbogears.widgets.meta import load_kid_template
> 
> class MyWidget(widgets.Widget):
>    "A widget loading the template from app_name/templates/widgets/
> my_widget.kid"
>    template_c, template =
> load_kid_template("app_name.templates.widgets.my_widget")
> # ----- EOF

You actually can just put a template module path in the "template"
attribute of a widget:

class MyWidget(Widget):
    template = "yourpkg.templates.widgets.foo"
    ....

Chris

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to