[Zope-Checkins] CVS: Zope/lib/python/AccessControl/tests - testSecurity.py:1.10.6.2

Tres Seaver tseaver at zope.com
Mon Jan 12 16:39:16 EST 2004


Update of /cvs-repository/Zope/lib/python/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv8958/lib/python/AccessControl/tests

Modified Files:
      Tag: Zope-2_6-branch
	testSecurity.py 
Log Message:


  - Collector #1169: ensure that safe version of 'min' and 'max' are
    available in the DTML namespace.  Note that we can only test for this
    stuff under AccessControl;  the "safe" versions of the builtins aren't
    available in DocumentTemplate, which should *not* import them from
    AccessControl.

  - testDTML.py:  clean out conflict-generating cruft.


=== Zope/lib/python/AccessControl/tests/testSecurity.py 1.10.6.1 => 1.10.6.2 ===
--- Zope/lib/python/AccessControl/tests/testSecurity.py:1.10.6.1	Thu Jan  8 15:12:07 2004
+++ Zope/lib/python/AccessControl/tests/testSecurity.py	Mon Jan 12 16:38:45 2004
@@ -21,7 +21,7 @@
 from DocumentTemplate import HTML
 from DocumentTemplate.tests.testDTML import DTMLTests
 from Products.PythonScripts.standard import DTML
-from AccessControl import Unauthorized
+from AccessControl import User, Unauthorized
 from ExtensionClass import Base
 
 class UnownedDTML(DTML):
@@ -73,6 +73,26 @@
             y = 10
         res = html(c=c)
         assert res == '10', res
+
+    def testNewDTMLBuiltins(self):
+
+        #
+        #   N.B.:  we *don't* test for the 2.2 / 2.3-only builtins
+        #          (sum, iter, enumerate) because they *shouldn't* be
+        #          available in Zope 2.6, which must be restricted to
+        #          Python 2.1 idioms.
+        #
+        NEW_BUILTINS_TEMPLATE = """
+        <dtml-var expr="_.min([1,2])">
+        <dtml-var expr="_.max([2,3])">
+        """
+        EXPECTED = ['1', '3']
+
+        template = self.doc_class(NEW_BUILTINS_TEMPLATE)
+        res = template()
+        lines = filter(None, [x.strip() for x in res.split('\n')])
+
+        self.assertEqual(lines, EXPECTED)
 
     # Note: we need more tests!
 




More information about the Zope-Checkins mailing list