Merge r41227 from 2.9 branch:

  Update Five to bugfix release 1.3.1.
parent 4abec22a
......@@ -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)
=====================
......
......@@ -111,7 +111,10 @@ class FiveSiteManager(object):
@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 @@ class FiveSiteManager(object):
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)
......
......@@ -85,9 +85,27 @@ The utility registry, however, is an ``IFiveUtilityRegistry``:
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,6 +136,10 @@ The Zope 3 API for this agrees with that:
>>> 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:
......
......@@ -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 Adaptable:
class Adapter:
implements(IAdapted)
adapts(IAdaptable)
def __init__(self, context):
self.context = context
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment