Commit f5fc8da1 authored by Florent Guillaume's avatar Florent Guillaume

Merged r68461 from 2.10 branch:

  Empty TALES path expressions are allowed in Zope 2.
  http://www.zope.org/Collectors/Zope/2118
parent b2463a85
...@@ -99,6 +99,8 @@ def render(ob, ns): ...@@ -99,6 +99,8 @@ def render(ob, ns):
class ZopePathExpr(PathExpr): class ZopePathExpr(PathExpr):
def __init__(self, name, expr, engine): def __init__(self, name, expr, engine):
if not expr.strip():
expr = 'nothing'
super(ZopePathExpr, self).__init__(name, expr, engine, super(ZopePathExpr, self).__init__(name, expr, engine,
boboAwareZopeTraverse) boboAwareZopeTraverse)
......
...@@ -86,6 +86,15 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase): ...@@ -86,6 +86,15 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
self.failUnless(isinstance(defer, DeferWrapper)) self.failUnless(isinstance(defer, DeferWrapper))
self.failUnless(isinstance(lazy, LazyWrapper)) self.failUnless(isinstance(lazy, LazyWrapper))
def test_empty_ZopePathExpr(self):
"""Test empty path expressions.
"""
ec = self.ec
self.assertEquals(ec.evaluate('path:'), None)
self.assertEquals(ec.evaluate('path: '), None)
self.assertEquals(ec.evaluate(''), None)
self.assertEquals(ec.evaluate(' \n'), None)
def test_suite(): def test_suite():
return unittest.makeSuite(ExpressionTests) return unittest.makeSuite(ExpressionTests)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment