[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #1803: Fixed InitializeClass for some corner case

Florent Guillaume fg at nuxeo.com
Tue Jun 7 09:12:25 EDT 2005


Log message for revision 30675:
  Collector #1803: Fixed InitializeClass for some corner case
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py
  A   Zope/branches/Zope-2_8-branch/lib/python/App/tests/test_class_init.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-07 03:47:34 UTC (rev 30674)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-06-07 13:12:24 UTC (rev 30675)
@@ -26,6 +26,8 @@
 
     Bugs Fixed
 
+      - Collector #1803: Fixed InitializeClass for some corner case.
+
       - Collector #1798, issue 1: ZopeTestCase no longer tries to 
         install products that was installed by Zope during startup.
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py	2005-06-07 03:47:34 UTC (rev 30674)
+++ Zope/branches/Zope-2_8-branch/lib/python/App/class_init.py	2005-06-07 13:12:24 UTC (rev 30675)
@@ -43,8 +43,8 @@
             else:
                 # Supply a name implicitly so that the method can
                 # find the security assertions on its container.
-                d['_implicit__name__'] = 1
-                d['__name__']=name
+                v._implicit__name__ = 1
+                v.__name__ = name
             if name=='manage' or name[:7]=='manage_':
                 name=name+'__roles__'
                 if not have(name):

Added: Zope/branches/Zope-2_8-branch/lib/python/App/tests/test_class_init.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/App/tests/test_class_init.py	2005-06-07 03:47:34 UTC (rev 30674)
+++ Zope/branches/Zope-2_8-branch/lib/python/App/tests/test_class_init.py	2005-06-07 13:12:24 UTC (rev 30675)
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Tests class initialization.
+"""
+
+import ExtensionClass
+from App.class_init import default__class_init__ as InitializeClass
+
+
+def test_InitializeClass():
+    """Test that InitializeClass (default__class_init__)
+    works in specific corner cases.
+
+    Check when the class has an ExtensionClass as attribute.
+
+    >>> class AnotherClass(ExtensionClass.Base):
+    ...     _need__name__ = 1
+
+    >>> class C:
+    ...     foo = AnotherClass
+
+    >>> InitializeClass(C)
+    """
+
+from zope.testing.doctest import DocTestSuite
+import unittest
+
+def test_suite():
+    return unittest.TestSuite((
+        DocTestSuite(),
+        ))
+
+if __name__ == '__main__':
+    unittest.main()


Property changes on: Zope/branches/Zope-2_8-branch/lib/python/App/tests/test_class_init.py
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Zope-Checkins mailing list