[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Fixed some failing tests when running combinations of unit and functional

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Apr 8 14:34:05 EDT 2005


Log message for revision 29919:
  Fixed some failing tests when running combinations of unit and functional 
  tests.
  

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/codemodule/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
  U   Zope3/trunk/src/zope/app/preference/preference.py

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/codemodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/codemodule/tests.py	2005-04-08 17:48:30 UTC (rev 29918)
+++ Zope3/trunk/src/zope/app/apidoc/codemodule/tests.py	2005-04-08 18:34:05 UTC (rev 29919)
@@ -41,12 +41,8 @@
     placelesssetup.tearDown()
     global old_context
     zope.app.appsetup.appsetup.__config_context = old_context    
-    from zope.app.apidoc import zcmlmodule
-    zcmlmodule.namespaces = None
-    zcmlmodule.subdirs = None
 
 
-
 def test_suite():
     return unittest.TestSuite((
         doctest.DocFileSuite('README.txt',

Modified: Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py	2005-04-08 17:48:30 UTC (rev 29918)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py	2005-04-08 18:34:05 UTC (rev 29919)
@@ -178,3 +178,13 @@
             list.append((namespace.getQuotedName(), namespace))
         list.sort()
         return list
+
+
+def _clear():
+    global namespaces
+    global subdirs
+    namespaces = None
+    subdirs = None
+    
+from zope.testing.cleanup import addCleanUp
+addCleanUp(_clear)

Modified: Zope3/trunk/src/zope/app/preference/preference.py
===================================================================
--- Zope3/trunk/src/zope/app/preference/preference.py	2005-04-08 17:48:30 UTC (rev 29918)
+++ Zope3/trunk/src/zope/app/preference/preference.py	2005-04-08 18:34:05 UTC (rev 29919)
@@ -162,6 +162,9 @@
             self.data[key] = value
         else:
             self.__dict__[key] = value
+            # If the schema changed, we really need to change the security
+            # checker as well.
+            self.__dict__['__Security_checker__'] = PreferenceGroupChecker(self)
 
     def __delattr__(self, key):
         if self.__schema__ and key in self.__schema__:
@@ -188,9 +191,8 @@
     data = property(data)
 
 
-
 def PreferenceGroupChecker(instance):
-    """A function that can be registered as a Checker in defineChecker()
+    """A function that generates a custom security checker.
 
     The attributes available in a preference group are dynamically generated
     based on the group schema and the available sub-groups. Thus, the
@@ -220,9 +222,7 @@
 
     return Checker(read_perm_dict, write_perm_dict)
 
-defineChecker(PreferenceGroup, PreferenceGroupChecker)
 
-
 def UserPreferences(context=None):
     """Adapts an ``ILocation`` object to the ``IUserPreferences`` interface."""
     if context is None:



More information about the Zope3-Checkins mailing list