On Aug 28, 2010, at 1:22 PM, Robert Sudwarts wrote: > Hi, > > I'm having difficulties with a javascript conflict: I have a master template > which includes jquery for some dropdown menus and subsequent pages which make > use of toscawidgets (which have their own further js links). > > Looking at the toscawidgets docs > (http://toscawidgets.org/documentation/ToscaWidgets/require_once.html#id1) > there appears to be some functionality to prevent this kind of collision; > namely "toscawidgets.middleware.require_once" > I think that this could well be the solution to the conflict/problem. > > Their site says "See :doc: `configuration' on how to enable it" -- but the > link is dead! > > I'm sure I can't be the first person to have bumped into this problem, but I > have absolutely no idea how to access/set the > 'toscawidgets.middleware.require_once" to true. Is this a config setting? an > additional call to be placed somewhere in my code??
require_once won't help. The problem you have is that you include jquery by-passing the TW resources mechanism. Thus TW doesn't know that jquery is already available, and includes it again. There are a few ways out of this, IMHO the shortest and easiest to grasp is to put the following python-block into your master.html: <?python from tw.jquery import jquery_js jquery_js.inject() ?> This will inject jquery into all your pages, and in case of other widgets also relying on it will do the right thing not to include them twice. 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=en.

