[Zope3-checkins] SVN: Zope3/trunk/src/zope/tales/ Previously in the TALES syntax obj/adaptor:name, name was restricted

Stuart Bishop stuart at stuartbishop.net
Wed Jul 14 22:45:09 EDT 2004


Log message for revision 26544:
  Previously in the TALES syntax obj/adaptor:name, name was restricted
  to being a Python identifier. I've removed this restriction to allow
  traversal using __getitem__ and allow sessions to work with the current
  preferred syntax (`request/session:product.id`)
  
  


Changed:
  U   Zope3/trunk/src/zope/tales/expressions.py
  U   Zope3/trunk/src/zope/tales/tests/test_expressions.py


-=-
Modified: Zope3/trunk/src/zope/tales/expressions.py
===================================================================
--- Zope3/trunk/src/zope/tales/expressions.py	2004-07-15 00:06:40 UTC (rev 26543)
+++ Zope3/trunk/src/zope/tales/expressions.py	2004-07-15 02:45:08 UTC (rev 26544)
@@ -73,9 +73,6 @@
                     if not _valid_name(namespace):
                         raise CompilerError('Invalid namespace name "%s"'
                                             % namespace)
-                    if not _valid_name(functionname):
-                        raise CompilerError('Invalid function name "%s"'
-                                            % functionname)
                     try:
                         compiledpath.append(
                             self._engine.getFunctionNamespace(namespace))

Modified: Zope3/trunk/src/zope/tales/tests/test_expressions.py
===================================================================
--- Zope3/trunk/src/zope/tales/tests/test_expressions.py	2004-07-15 00:06:40 UTC (rev 26543)
+++ Zope3/trunk/src/zope/tales/tests/test_expressions.py	2004-07-15 02:45:08 UTC (rev 26544)
@@ -224,17 +224,6 @@
         else:
             self.fail('Engine accepted invalid namespace name')
 
-    def testInvalidFunctionName(self):
-        from zope.tales.tales import CompilerError
-        try:
-            self.engine.compile('adapterTest/foo:1bar')
-        except CompilerError,e:
-            self.assertEqual(e.args[0],
-                             'Invalid function name "1bar"')
-        else:
-            self.fail('Engine accepted invalid function name')
-
-
     def testBadFunction(self):
         from zope.tales.tales import CompilerError
         # namespace is fine, adapter is not defined



More information about the Zope3-Checkins mailing list