[Zope-Checkins] SVN: Zope/trunk/ Got rid of PythonScripts test dependency in DocumentTemplate

Hanno Schlichting hannosch at hannosch.eu
Sun Jun 13 14:33:39 EDT 2010


Log message for revision 113430:
  Got rid of PythonScripts test dependency in DocumentTemplate
  

Changed:
  U   Zope/trunk/AC-vs-DTML-TODO.txt
  U   Zope/trunk/src/DocumentTemplate/tests/testSecurity.py

-=-
Modified: Zope/trunk/AC-vs-DTML-TODO.txt
===================================================================
--- Zope/trunk/AC-vs-DTML-TODO.txt	2010-06-13 17:45:29 UTC (rev 113429)
+++ Zope/trunk/AC-vs-DTML-TODO.txt	2010-06-13 18:33:39 UTC (rev 113430)
@@ -54,7 +54,3 @@
     configuration via zope.conf. The calls are localized to one function each.
     Add an optional dependency on Zope2? Configure if it is available,
     otherwise use some default?
-
-- Test only dependencies:
-
-  * Products.PythonScripts

Modified: Zope/trunk/src/DocumentTemplate/tests/testSecurity.py
===================================================================
--- Zope/trunk/src/DocumentTemplate/tests/testSecurity.py	2010-06-13 17:45:29 UTC (rev 113429)
+++ Zope/trunk/src/DocumentTemplate/tests/testSecurity.py	2010-06-13 18:33:39 UTC (rev 113430)
@@ -17,15 +17,29 @@
 
 from DocumentTemplate import HTML
 from DocumentTemplate.tests.testDTML import DTMLTests
-from Products.PythonScripts.standard import DTML
+from DocumentTemplate.security import RestrictedDTML
 from AccessControl import Unauthorized
+from AccessControl.SecurityManagement import getSecurityManager
 from ExtensionClass import Base
 
-class UnownedDTML(DTML):
+
+class UnownedDTML(RestrictedDTML, HTML):
+
     def getOwner(self):
         return None
 
-class SecurityTests (DTMLTests):
+    def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
+        """Render the DTML"""
+        security = getSecurityManager()
+        security.addContext(self)
+        try:
+            return HTML.__call__(self, client, REQUEST, **kw)
+        finally:
+            security.removeContext(self)
+
+
+class SecurityTests(DTMLTests):
+
     doc_class = UnownedDTML
     unrestricted_doc_class = HTML
 



More information about the Zope-Checkins mailing list