Luckily, TG has provided wrappers for all of the major JS libraries, including:
- and yes, Mochikit
Then, we want to modify the base controller in our project so that it injects the js file link on every page call. Open up the mytgapp/lib/base.py file. Add the import for your selected JS app at the top of the file, in our case, this is dojo_js:
from tw.dojo import dojo_js
Next, modify the __call__ method of the BaseController. Call the inject method inside the __call__ method:
That’s pretty much it. You have to figure out what library uses what name for thier js widgets, but most of them are fairly obvious. The other alternative is to put the file in your static directory, and add it directly to your master.html template.