[Zope3-Users] Seeking a ZCML Example for a CSSViewlet
I've got viewlets working fine (really cool too!) but I'm stumped on getting a CSSViewlet declared. Googling doesn't show anyone using CSSViewlets but hopefully someone who implemented it might clarify. The doc files show how to do it with pure Python and the utility function viewlet.viewlet.CSSViewlet but I need it using ZCML. I'm trying: This bypasses the utility function and generates an error about there being no 'index' attribute, which is the small template file containing the parameterized HTML link tag, in the result class. So I give it a template file, although I really hate putting such a full path in my component ZCML file: template="/usr/share/zope-3.3.0-py2.4/lib/python/zope/viewlet/css_viewlet.pt" And now it errors out about a missing '_path' class attribute, which is passed into the utility function. I've also thought about passing in the utility function via a 'factory=' parameter but the viewlet directive doesn't support such a parameter. And I've tried just passing in the utility function on a 'class=' parameter, figuring maybe it just wants a callable. No luck, it wants a real class to pass into type() for instantiation. It's only seven lines of ZCML but I sure can't see how to use it properly. Next I'll just roll my own ZCML directive but it seems there ought to be a way to use CSSViewlet as intended and I'm just missing it. Help please? -Jeff ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Seeking a ZCML Example for a CSSViewlet
On Fri, 2006-10-06 at 20:29 -0500, Jeff Rush wrote: > I've got viewlets working fine (really cool too!) but I'm stumped on getting a > CSSViewlet declared. Googling doesn't show anyone using CSSViewlets but > hopefully someone who implemented it might clarify. > Help please? > > -Jeff Hi Jeff, I do it like this (forgetting where the boilerplate came from - thanks to someone).: python code:: BRSPublicLayerLayoutCSSViewlet = zope.viewlet.viewlet.CSSViewlet('style/layout.css', 'all') configure zcml:: And the manager: python code:: class ICSS(zope.viewlet.interfaces.IViewletManager): configure zcml:: And it gets into main template:: Hope this helps. Best regards, Darryl ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Seeking a ZCML Example for a CSSViewlet
Le samedi 07 octobre 2006 à 17:00 +1300, Darryl Cousins a écrit : configure zcml:: name="layout.css" for=""> manager="barrysmithgallery.layer.public.ICSS" permission="zope.Public" class="..BRSPublicLayerLayoutCSSViewlet" layer="barrysmithgallery.layer.public.IBRSPublicBrowserLayer" weight="2" /> Maybe I'm wrong, but it seems that the "weight" parameter is not used by the default implementation of the CSS viewlet manager... Correct ? Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Seeking a ZCML Example for a CSSViewlet
On Mon, 2006-10-09 at 18:50 +0200, Thierry Florac wrote: > Maybe I'm wrong, but it seems that the "weight" parameter is not used > by the default implementation of the CSS viewlet manager... > Correct ? > > Thierry Florac > Hi, Yes you are right. Sorry for throwing in the confusion. Regards, Darryl ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users