Thang Nguyen schrieb:
> Hi,
>
> I added the line below into app_cfg.py for enabling Mochikit, but kept
> on getting error.
>
> This is the new line added to app_cfg.py:
>
> tg.include_widgets = ['turbogears.mochikit']
>
> The error I got:
> from helloworld.config.app_cfg import base_config
> File "C:\turbogears\sandbox\HelloWorld\helloworld\config\app_cfg.py", line
> 66,
> in <module>
> tg.include_widgets = ['turbogears.mochikit']
> NameError: name 'tg' is not defined
This is only worknig in TG1.
There is no direct equivalent for this in TG2.
First of all, you need to install tw.mochikit. Then the normal procedure
is to write a ToscaWidget that declares a dependency to that widget.
As a result, the tw.mochikit will be automatically injected into the page.
Alternatively, you can call .inject() on the respective widget youself.
I don't use tw.mochikit, but for e.g. jquery, this works roughly like this:
from tw.jquery import jquery_js
class MyController(...):
@expose(...)
def action(self):
jquery_js.inject()
...
If you are a 100% sure you want MK with *every* page, then you should
consider placing the inject into your BaseController.__call__.
Diez
--
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=.