Re: [Zope3-Users] Seeking a ZCML Example for a CSSViewlet

2006-10-09 Thread Thierry Florac




Le samedi 07 octobre 2006  17:00 +1300, Darryl Cousins a crit:


configure zcml::

  browser:viewlet
  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 Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +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

2006-10-09 Thread Darryl Cousins
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


[Zope3-Users] Seeking a ZCML Example for a CSSViewlet

2006-10-06 Thread Jeff Rush
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:

  browser:viewlet
name=success.css-link
manager=.interfaces.IStylingLinks
permission=zope.Public
media=screen
rel=css
class=zope.viewlet.viewlet.CSSResourceViewletBase
/

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

2006-10-06 Thread Darryl Cousins
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::

  browser:viewlet
  name=layout.css
  for=*
  manager=barrysmithgallery.layer.public.ICSS
  permission=zope.Public
  class=..BRSPublicLayerLayoutCSSViewlet
  layer=barrysmithgallery.layer.public.IBRSPublicBrowserLayer
  weight=2
  /

And the manager:

python code::


class ICSS(zope.viewlet.interfaces.IViewletManager):

configure zcml::

  browser:viewletManager
  name=barrysmithgallery.layer.public.ICSS
  provides=barrysmithgallery.layer.public.ICSS
  layer=barrysmithgallery.layer.public.IBRSPublicBrowserLayer
  permission=zope.Public
  /

And it gets into main template::

 tal:block replace=structure provider:barrysmithgallery.layer.public.ICSS /

Hope this helps.

Best regards,
Darryl

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users