[Zope-dev] Re: SVN: Zope/branches/ajung-zpt-end-game/...

Tres Seaver tseaver at palladion.com
Wed May 31 13:20:32 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Florent Guillaume wrote:
> Tres Seaver wrote:
> 
>>> I agree with you that there should be BBB code that provides the old
>>> behavior and I agree with Philipp that not using that old behavior is a
>>> benefit for the CMF.
>>
>>
>> Sure.  I just don't want to *make* people upgrade CMF when upgrading
>> Zope, unless there is a reason which is important *to the CMF*.
>>
>> An interesting factoid I found while spelunking this issue: the CMF (by
>> way of DCWorkflow) is literally the oldest consumer of the expression
>> machinery outside of ZPT itself!  Shane's earliest checkin of the
>> 'Expression' module was nearly 5 years ago, and used an empty string as
>> the class-level default for the 'text' attribute.
> 
> 
> FWIW the following patches gives the proper BBB behaviour.
> Shall I check it in? Does it need to send a deprecation warning?
> 
> Florent
> 
> Index: Products/PageTemplates/Expressions.py
> ===================================================================
> --- Products/PageTemplates/Expressions.py    (revision 68406)
> +++ Products/PageTemplates/Expressions.py    (working copy)
> @@ -99,6 +99,8 @@
>  class ZopePathExpr(PathExpr):
> 
>      def __init__(self, name, expr, engine):
> +        if name == 'standard' and not expr:
> +            expr = 'nothing'
>          super(ZopePathExpr, self).__init__(name, expr, engine,
>                                             boboAwareZopeTraverse)
> 

I uploaded a similar one, except with deprecation warning, to the
collector issue I added:

 http://www.zope.org/Collectors/Zope/2118

My variation also creates an expression which would raise a KeyError if
evaluated, rather than returning None.  I don't think anybody can
actually be depending on what the current code gives back if an empty
expression is called, so yours should be equally fine.

WRT dprecation:  I would actually prefer no* to have the warning,
myself;  I don't think that a usage which has been workable for so long
is actually in error.

We should probably add a test which verifies compilability of empty
expressions, plus whichever behavior we specify.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEfdBg+gerLs4ltQ4RAv3dAJ9nupwaHlRIwjs/0x7jPjswZ8+28ACcDzJj
BhQgjD0j0eobvHNhejOo2Mk=
=N7uW
-----END PGP SIGNATURE-----


More information about the Zope-Dev mailing list