Empty TALES path expressions now raise

Bug #143710 reported by Tres Seaver
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Medium
Tres Seaver

Bug Description

From time immemorial, the CMF has used TALES path expressions
whose expression text was empty. The old behavior of such
an expression was to be compilable, and, when evaluated, to
return the expression context itself. Such expressions in
CMF and Plone are routinely *compiled* but not evaluated,
and have a *ton* of persistent instance which have such empty
strings stored as their expression text.

After landing the changes to use the Zope3 version, such
expressions are no longer compilable. The attached patch
restores their compilability, and adds a deprecation warning
when they are compiled.

Revision history for this message
Tres Seaver (tseaver) wrote :
Revision history for this message
Philipp von Weitershausen (philikon) wrote :

Fortunately, TALES expression objects themselves aren't pickled, only a small wrapper that's provided by the CMF and simply holds a) the expression text and b) possibly a volatile handle to the compiled expression.

As far as I understand, http://svn.zope.org/?rev=68396&view=rev and http://svn.zope.org/?view=rev&rev=68424 made this container robust against compiling empty TALES expressions.

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

There seems to be a general consensus that BBB should be provided (see e.g. http://mail.zope.org/pipermail/zope-dev/2006-May/027554.html). It is unclear yet what the intended behaviour should be in the future:

* Return None or raise KeyError? I would actually prefer to return None. (I originally thought about returning True because if someone evaluated an empty TALES expression to a boolean value before, one would get True; but I guess this would be very confusing in the future)

* Deprecate and eventually remove the ability to compile empty tales expressions or support them forever? Florent is suggesting to support them in the future, Tres's patch issues a deprecation warning. I'd be fine with whatever, but perhaps in the interest of bringing both Zope versions together eventually, we should keep the differences in behaviour small.

Revision history for this message
Florent Guillaume (efge) wrote :

Status: Accepted => Resolved

Fixed by allowing empty path expressions, in 2.10 and trunk.
They evaluate to None.
http://svn.zope.org/?view=rev&rev=68461

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.