Re: Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On 10/31/06, Gary Poster [EMAIL PROTECTED] wrote: I do a lot inline in my Python code, using our nevow.Stan inspired tag generation system and little bits and pieces I threw together to ease in generating short bits of JS from within Python. In particular, marshalling of basic Python structures to Javascript using a modified `jsonencode` module from the `simplejson` package. What are the modifications? The things you list below all sound like normal simplejson stuff. The main modification is that it pass over 'raw' JS Code - statements that have already been encoded, function calls, raw names, etc. I think I did some tweaks to its string quoting system as well, but I don't recall. :: print js.encode('raw') 'raw' print js.encode(js.raw('raw')) raw This gets to be handy when generating function calls. `js.call` str's the first option, and then encodes the rest to create an arguments list, which it returns as a `js.raw` object so that it won't be quoted as a string:: dumbalert = js.call('window.alert', 'Stupid simple example') print dumbalert window.alert('Stupid simple example') print js.anonymous(js.expr(dumbalert)) function() {window.alert('Stupid simple example');} print js.call('setTimeout', js.anonymous(js.expr(dumbalert)), 5*1000) setTimeout(function() {window.alert('Stupid simple example');}, 5000) It's simple, but helpful, especially as calls and data build up. But even without building up a little system like this, it's probably good to use tools like `simplejson` to keep javascript data pretty, even in generated strings such as in TAL/TALES, just as it's good practice to use SQL Quoting. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Ah, the real reason for my response here: how does one use third party WSGI Middleware with Zope? zope.paste, maybe (http://svn.zope.org/zope.paste/)? I think that's what Jim Washington has used. Ahh, thanks, I'll take a look. -- Jeff Shell ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On 10/24/06, Gary Poster [EMAIL PROTECTED] wrote: It might be nice to have zc.resourcelibrary be able to somehow serve z3c.zrtresource files too...it doesn't right now. FWIW, right now in lieu of zrtresource I just use script ... tal:content=string: /* ... JS that specifies dynamic variables and calls ... */ /script. Simple, and encourages delineation between library and usage; but a bit hacky, and unfriendly to designers. I do a lot inline in my Python code, using our nevow.Stan inspired tag generation system and little bits and pieces I threw together to ease in generating short bits of JS from within Python. In particular, marshalling of basic Python structures to Javascript using a modified `jsonencode` module from the `simplejson` package. Among other things, it lets me use normal Python dictionaries, strings, lists, numbers, etc, for use in generating code. `jsonencode` ensures that everything is escaped properly. It gets to be handy to build on, especially when wanting to generate a Javascript call and supply it with a big list of generated dictionaries. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Ah, the real reason for my response here: how does one use third party WSGI Middleware with Zope? Alternately, does anyone have any experience running Zope in another WSGI supporting server? There are quite a few things out there in WSGI land that I'm interested in, but I've never quite understood how they work together on their own and/or with big systems like Zope. By the way - I've had some issues with the dependency tracking in zc.resourcelibrary. Is there a tracker where I can post said issues? (if I can remember and reconstruct them, that is) -- Jeff Shell ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On Tuesday 31 October 2006 19:15, Jeff Shell wrote: Ah, the real reason for my response here: how does one use third party WSGI Middleware with Zope? Alternately, does anyone have any experience running Zope in another WSGI supporting server? Yes, the openplan project, which has Ian Bicking on board, does a lot of this type of mixing. You might want to talk to them. Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On Oct 31, 2006, at 7:15 PM, Jeff Shell wrote: On 10/24/06, Gary Poster [EMAIL PROTECTED] wrote: It might be nice to have zc.resourcelibrary be able to somehow serve z3c.zrtresource files too...it doesn't right now. FWIW, right now in lieu of zrtresource I just use script ... tal:content=string: /* ... JS that specifies dynamic variables and calls ... */ /script. Simple, and encourages delineation between library and usage; but a bit hacky, and unfriendly to designers. I do a lot inline in my Python code, using our nevow.Stan inspired tag generation system and little bits and pieces I threw together to ease in generating short bits of JS from within Python. In particular, marshalling of basic Python structures to Javascript using a modified `jsonencode` module from the `simplejson` package. What are the modifications? The things you list below all sound like normal simplejson stuff. Among other things, it lets me use normal Python dictionaries, strings, lists, numbers, etc, for use in generating code. `jsonencode` ensures that everything is escaped properly. It gets to be handy to build on, especially when wanting to generate a Javascript call and supply it with a big list of generated dictionaries. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Ah, the real reason for my response here: how does one use third party WSGI Middleware with Zope? zope.paste, maybe (http://svn.zope.org/zope.paste/)? I think that's what Jim Washington has used. Alternately, does anyone have any experience running Zope in another WSGI supporting server? There are quite a few things out there in WSGI land that I'm interested in, but I've never quite understood how they work together on their own and/or with big systems like Zope. By the way - I've had some issues with the dependency tracking in zc.resourcelibrary. Is there a tracker where I can post said issues? (if I can remember and reconstruct them, that is) Yeah, the dependency code was pretty badly broken until Marius Gedminas fixed it within the past week or two. Try it again. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.zrtresource or zc.resourcelibrary
Which one should I use for my new zope 3 site? z3c.zrtresource or zc.resourcelibrary? I don't understand the difference between them and I don't have hours to spare on evaluating both. I'm sure they do different things and do them differently well. My aim to be able to smoothly define css, images, js without too much magic for my one and only skin. -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On Oct 24, 2006, at 8:41 AM, Peter Bengtsson wrote: Which one should I use for my new zope 3 site? z3c.zrtresource or zc.resourcelibrary? I don't understand the difference between them and I don't have hours to spare on evaluating both. I'm sure they do different things and do them differently well. My aim to be able to smoothly define css, images, js without too much magic for my one and only skin. It sounds like you may just want the standard Zope 3 resourcedirectory: just makes JS, CSS, images, et al available. z3c.zrtresource: a way to write dynamic css and js files. For instance, you have a css file that wants to refer to an image served by Zope, taking virtual hosting into account. Particularly suitable for situations when you are working with a shop that has a separate design team. Of course, can be effectively used in other environments as well. zc.resourcelibrary: a resourcedirectory-based tool to define and use resources with dependencies. For instance, one part of your assembled page, like a widget, needs MochiKit; another part, maybe a widget, needs a custom library that uses MochiKit; and another part needs a second custom library that depends on MochiKit.New, that itself depends on MochiKit; all three are assembled dynamically, and need to put JS/CSS code in the head, preferably without duplication, and in the right order. It might be nice to have zc.resourcelibrary be able to somehow serve z3c.zrtresource files too...it doesn't right now. FWIW, right now in lieu of zrtresource I just use script ... tal:content=string: /* ... JS that specifies dynamic variables and calls ... */ /script. Simple, and encourages delineation between library and usage; but a bit hacky, and unfriendly to designers. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users