[Zope-Checkins] 
	SVN: Zope/branches/2.10/lib/python/Products/PageTemplates/
	Empty TALES path expressions are allowed in Zope 2.
    Florent Guillaume 
    fg at nuxeo.com
       
    Fri Jun  2 11:02:16 EDT 2006
    
    
  
Log message for revision 68461:
  Empty TALES path expressions are allowed in Zope 2.
  http://www.zope.org/Collectors/Zope/2118
  
Changed:
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
  U   Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py
-=-
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py	2006-06-02 14:38:06 UTC (rev 68460)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py	2006-06-02 15:02:15 UTC (rev 68461)
@@ -99,6 +99,8 @@
 class ZopePathExpr(PathExpr):
 
     def __init__(self, name, expr, engine):
+        if not expr.strip():
+            expr = 'nothing'
         super(ZopePathExpr, self).__init__(name, expr, engine,
                                            boboAwareZopeTraverse)
 
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py	2006-06-02 14:38:06 UTC (rev 68460)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py	2006-06-02 15:02:15 UTC (rev 68461)
@@ -86,6 +86,15 @@
         self.failUnless(isinstance(defer, DeferWrapper))
         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():
     return unittest.makeSuite(ExpressionTests)
 
    
    
More information about the Zope-Checkins
mailing list