[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/component/ Fixed a bug that local site manager was not copied properly(Issue 758).

Yusei Tahara yusei at domen.cx
Wed Mar 14 02:16:39 EDT 2007


Log message for revision 73163:
  Fixed a bug that local site manager was not copied properly(Issue 758).
  

Changed:
  U   Zope3/trunk/src/zope/app/component/site.py
  A   Zope3/trunk/src/zope/app/component/tests/test_localsitemanager.py

-=-
Modified: Zope3/trunk/src/zope/app/component/site.py
===================================================================
--- Zope3/trunk/src/zope/app/component/site.py	2007-03-14 06:04:06 UTC (rev 73162)
+++ Zope3/trunk/src/zope/app/component/site.py	2007-03-14 06:16:38 UTC (rev 73163)
@@ -198,6 +198,9 @@
     def _init_registries(self):
         self.adapters = _LocalAdapterRegistry()
         self.utilities = _LocalAdapterRegistry()
+        self.adapters.__parent__ = self.utilities.__parent__ = self
+        self.adapters.__name__ = u'adapters'
+        self.utilities.__name__ = u'utilities'
 
     def addSub(self, sub):
         """See interfaces.registration.ILocatedRegistry"""

Added: Zope3/trunk/src/zope/app/component/tests/test_localsitemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_localsitemanager.py	2007-03-14 06:04:06 UTC (rev 73162)
+++ Zope3/trunk/src/zope/app/component/tests/test_localsitemanager.py	2007-03-14 06:16:38 UTC (rev 73163)
@@ -0,0 +1,54 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Local sitemanager tests.
+
+$Id$
+"""
+import unittest
+
+from zope.interface import Interface
+from zope.copypastemove import ObjectCopier
+from zope.app.component import site
+from zope.app.folder import Folder
+from zope.app.testing.placelesssetup import PlacelessSetup
+
+class I1(Interface):pass
+
+class TestLocalSiteManager(PlacelessSetup, unittest.TestCase):
+
+    def setUp(self):
+        super(TestLocalSiteManager, self).setUp()
+
+        self.util = object()
+        self.root = Folder()
+        self.root['site'] = Folder()
+        subfolder  = self.root['site']
+        subfolder.setSiteManager(site.LocalSiteManager(subfolder))
+        subfolder.getSiteManager().registerUtility(self.util, I1)
+
+    def testCopy(self):
+        self.assert_(self.root['site'].getSiteManager().getUtility(I1) is self.util)
+
+        copier = ObjectCopier(self.root['site'])
+        copier.copyTo(self.root, 'copied_site')
+
+        self.assert_(self.root['copied_site'].getSiteManager().getUtility(I1) is not self.util)
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestLocalSiteManager),
+        ))
+
+if __name__ == '__main__':
+    unittest.main()


Property changes on: Zope3/trunk/src/zope/app/component/tests/test_localsitemanager.py
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Zope3-Checkins mailing list