[Zope3-dev] RFC: zcml:condition
Roger Ineichen
dev at projekt01.ch
Sat Feb 19 16:47:08 EST 2005
Behalf Of Jim Fulton
> Sent: Saturday, February 19, 2005 10:01 PM
> To: Dieter Maurer
> Cc: Martijn Faassen; zope3-dev at zope.org
> Subject: Re: [Zope3-dev] RFC: zcml:condition
>
> Dieter Maurer wrote:
> > ... ZCML conditional ...
> >
> > There might be a wish for on "or" operator.
> >
> > Say we have two online help systems "A" and "B" which provide
> > similar APIs but each with special extensions.
> >
> > Then an application might want to say:
> >
> > condition="have(online_A) or have(online_B)"
>
> This feels like a slippery slope, at the bottom of
> which is Python. :)
>
> Perhaps, in this example, A and B should each provide
> "online". After all, the application doesn't depend
> on online_A or online_B, it depends on the part that's
> common, which is online.
For me it's unclear what the scope of foo is, if I define
a directive like.
<include zcml:condition="have foo" file="foo.zcml" />
Where is foo defined? Do we have another directive
like:
<zope:condition="foo" method="zope.app.bar.foo" />
And in the class zope.app.bar we have a method like:
def foo():
if today is sunday:
return True
return False
This way we could a method isAOrB and use it like:
def isAOrB ():
online_A = get_this_info_from_somewhere()
online_B = get_this_info_from_somewhere()
if online_A or online:
return True
return False
register:
<zope:condition="foo" method="zope.app.bar.isAOrB" />
use it:
<include zcml:condition="have isAOrB " file="foo.zcml" />
Or I'm wrong? Then where is the foo in "have foo" from?
Regards
Roger Ineichen
> Jim
>
> --
> Jim Fulton mailto:jim at zope.com Python Powered!
> CTO (540) 361-1714 http://www.python.org
> Zope Corporation http://www.zope.com http://www.zope.org
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub:
> http://mail.zope.org/mailman/options/zope3-dev/dev%40projekt01.ch
>
>
More information about the Zope3-dev
mailing list