Thanks, Chris!

I don't think I've seen a better explanation of how to set up a custom
javascript include directory anywhere.

My own past solutions have been ... hmmm ... much less elegant.  The bit
about "tg_include_widgets" is especially enlightening, as I had completely
forgotten that that existed.

Very useful! Thanks again!

Kevin Horn

On 2/8/07, Christopher Arndt <[EMAIL PROTECTED]> wrote:
>
>
> Kevin H schrieb:
> > Has anyone tried using the development release of MochiKit in their TG
> > apps?
>
> Yes.
>
> > Is it useable?
>
> I haven't tested it thoroughly but had no problems so far. I use it,
> because
> XmlHttp POST requests are a lot easier.
>
> > If so, how would you modify TG to use it?  Is it just a matter of
> > replacing the appropriate files, or is there more to it?
>
> I have built my own mini-widget as a replacement for the standard one:
>
> ---> myproject/widgets/jslibs/__init__.py <---
> __all__ = [
>   'mochikit'
> ]
>
> import pkg_resources
> from turbogears.widgets import JSLink, register_static_directory
>
> js_dir = pkg_resources.resource_filename("myproject.widgets.jslibs",
>   "static")
> register_static_directory("jslibs", js_dir)
>
> mochikit = JSLink("jslibs", "javascript/MochiKit.js")
> ---> end <---
>
> then put MochiKit.js 1.4 in myproject/widgets/jslibs/static/javascript
>
> and use it in your application by e.g. setting tg_include_widgets to
> ['myproject.widgets.jslibs.mochikit']
>
> This way you always have MochiKit 1.4 distributed with your app and don't
> rely
> on a patched TG installation.
>
>
> HTH, 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