Search This Blog

04 March 2011

patching an external lib at TurboGears startup

sometimes it is useful to monkey patch an external lib

in lib/patches.py

import logging
log = logging.getLogger(__name__)

from tw.jquery import ui
from tw.api import JSLink

# update to release 1.8.9
jquery_ui189 = JSLink(modname=__name__,
               filename='public/javascript/jquery.ui.all.js')

log.warning("Patching jquery.ui.all.js to 1.8.9")
ui.jquery_ui_all_js = jquery_ui189


now we need to inform TG of our patch

in project/config/middleware.py

import qubic.backoffice.lib.patches

that's it, at startup you should see :

Starting subprocess with file monitor
16:14:12,260 WARNI [project.lib.patches] Patching jquery.ui.all.js to 1.8.9

new releases

Long time without any post, time to update

I've recently released new packages and upgrades
is a tosca widget wrapper around the uploadify jquery plugin. It allows to send files to the server with a nice progress bar.
Flash required
this very small package allows to include .dot files in sphinx documentation and have them renderered with graphviz.
Sphinx easily accepts inline graph definition, but not inclusion of graph definition.
is now released in 0.3.1