[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/Five/ Merge r41227 from 2.9 branch:

Philipp von Weitershausen philikon at philikon.de
Sun Jan 8 11:06:02 EST 2006


Log message for revision 41228:
  Merge r41227 from 2.9 branch:
    Update Five to bugfix release 1.3.1.
  

Changed:
  U   Zope/trunk/lib/python/Products/Five/CHANGES.txt
  U   Zope/trunk/lib/python/Products/Five/site/localsite.py
  U   Zope/trunk/lib/python/Products/Five/site/tests/sitemanager.txt
  U   Zope/trunk/lib/python/Products/Five/tests/adapters.py
  U   Zope/trunk/lib/python/Products/Five/version.txt

-=-
Modified: Zope/trunk/lib/python/Products/Five/CHANGES.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/CHANGES.txt	2006-01-08 16:02:45 UTC (rev 41227)
+++ Zope/trunk/lib/python/Products/Five/CHANGES.txt	2006-01-08 16:06:01 UTC (rev 41228)
@@ -2,6 +2,15 @@
 Five Changes
 ============
 
+Five 1.3.1 (2006-01-08)
+=======================
+
+Bugfixes
+--------
+
+* Fix an adapter look-up bug in the local site implementation that was
+  due to an oversight during the port to Zope 3.2.
+
 Five 1.3 (2006-01-07)
 =====================
 

Modified: Zope/trunk/lib/python/Products/Five/site/localsite.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/site/localsite.py	2006-01-08 16:02:45 UTC (rev 41227)
+++ Zope/trunk/lib/python/Products/Five/site/localsite.py	2006-01-08 16:06:01 UTC (rev 41228)
@@ -111,7 +111,10 @@
 
     @property
     def adapters(self):
-        return getGlobalSiteManager().adapters #XXX wrong
+        next = self.next
+        if next is None:
+            next = getGlobalSiteManager()
+        return next.adapters
 
     @property
     def utilities(self):
@@ -124,7 +127,10 @@
         return self.adapters.queryMultiAdapter(objects, interface, name, default)
 
     def getAdapters(self, objects, provided):
-        return self.adapters.getAdapters(objects, provided)
+        next = self.next
+        if next is None:
+            next = getGlobalSiteManager()
+        return next.getAdapters(objects, provided)
 
     def subscribers(self, required, provided):
         return self.adapters.subscribers(required, provided)

Modified: Zope/trunk/lib/python/Products/Five/site/tests/sitemanager.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/site/tests/sitemanager.txt	2006-01-08 16:02:45 UTC (rev 41227)
+++ Zope/trunk/lib/python/Products/Five/site/tests/sitemanager.txt	2006-01-08 16:06:01 UTC (rev 41228)
@@ -85,11 +85,29 @@
   True
 
 The methods on registering and looking up utilities are covered by the
-utility tests in depth.  The methods on adapter look up are indirectly
-covered in the functional test; view look up, for example, is adapter
-look up.
+utility tests in depth.
 
+We test some adapter look-up here.  It is also indirectly covered in
+the functional test; view look up, for example, is adapter look up.
 
+First we provide an adapter:
+
+  >>> from Products.Five.tests.adapters import Adaptable, Adapter, IAdapted
+  >>> import zope.component
+  >>> zope.component.provideAdapter(Adapter)
+
+Now let's check for a simple adaption:
+
+  >>> adaptable = Adaptable()
+  >>> IAdapted(adaptable) #doctest: +ELLIPSIS
+  <Products.Five.tests.adapters.Adapter instance at ...>
+
+Let's get all the adapters for ``adaptable``:
+
+  >>> zapi.getAdapters((adaptable,), IAdapted) #doctest: +ELLIPSIS
+  [(u'', <Products.Five.tests.adapters.Adapter instance at ...>)]
+
+
 Nesting sites
 -------------
 
@@ -118,7 +136,11 @@
   >>> getNextSiteManager(subsite.getSiteManager()).context == dummysite
   True
 
+The adapters is registry is passed through to the global one:
 
+  >>> subsite.getSiteManager().adapters is zapi.getGlobalSiteManager().adapters
+  True
+
 Finally, some clean up:
 
   >>> tearDown()

Modified: Zope/trunk/lib/python/Products/Five/tests/adapters.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/adapters.py	2006-01-08 16:02:45 UTC (rev 41227)
+++ Zope/trunk/lib/python/Products/Five/tests/adapters.py	2006-01-08 16:06:01 UTC (rev 41228)
@@ -16,6 +16,7 @@
 $Id: adapters.py 12884 2005-05-30 13:10:41Z philikon $
 """
 from zope.interface import implements, Interface
+from zope.component import adapts
 
 class IAdaptable(Interface):
     """This is a Zope 3 interface.
@@ -49,6 +50,7 @@
 
 class Adapter:
     implements(IAdapted)
+    adapts(IAdaptable)
 
     def __init__(self, context):
         self.context = context

Modified: Zope/trunk/lib/python/Products/Five/version.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/version.txt	2006-01-08 16:02:45 UTC (rev 41227)
+++ Zope/trunk/lib/python/Products/Five/version.txt	2006-01-08 16:06:01 UTC (rev 41228)
@@ -1 +1 @@
-Five 1.3
+Five 1.3.1



More information about the Zope-Checkins mailing list