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:


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 Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to