[Checkins] SVN: zope.annotation/trunk/s factory locates objects now
instead of containing them. This way we get rid of the
dependency to zope.app.container
Christian Zagrodnick
cz at gocept.com
Fri Aug 17 08:12:45 EDT 2007
Log message for revision 78905:
factory locates objects now instead of containing them. This way we get rid of the dependency to zope.app.container
Changed:
U zope.annotation/trunk/setup.py
U zope.annotation/trunk/src/zope/annotation/factory.py
-=-
Modified: zope.annotation/trunk/setup.py
===================================================================
--- zope.annotation/trunk/setup.py 2007-08-17 12:11:43 UTC (rev 78904)
+++ zope.annotation/trunk/setup.py 2007-08-17 12:12:44 UTC (rev 78905)
@@ -35,8 +35,8 @@
install_requires=['setuptools',
'zope.interface',
'zope.component',
- 'zope.app.container',
- ],
+ 'zope.location>=3.4.0b1.dev-r78903',
+ ],
include_package_data = True,
zip_safe = False,
)
Modified: zope.annotation/trunk/src/zope/annotation/factory.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/factory.py 2007-08-17 12:11:43 UTC (rev 78904)
+++ zope.annotation/trunk/src/zope/annotation/factory.py 2007-08-17 12:12:44 UTC (rev 78905)
@@ -17,9 +17,11 @@
"""
import zope.component
import zope.interface
-from zope.annotation.interfaces import IAnnotations
-import zope.app.container.contained
+import zope.location.location
+import zope.annotation.interfaces
+
+
def factory(factory, key=None):
"""Adapter factory to help create annotations easily.
"""
@@ -35,18 +37,17 @@
@zope.component.adapter(list(adapts)[0])
@zope.interface.implementer(list(zope.component.implementedBy(factory))[0])
def getAnnotation(context):
- annotations = IAnnotations(context)
+ annotations = zope.annotation.interfaces.IAnnotations(context)
try:
result = annotations[key]
except KeyError:
result = factory()
annotations[key] = result
- # Containment has to be set up late to allow containment proxies
+ # Location has to be set up late to allow location proxies
# to be applied, if needed. This does not trigger an event and is idempotent
- # if containment is set up already.
- contained_result = zope.app.container.contained.contained(
- result, context, key)
- return contained_result
+ # if location or containment is set up already.
+ located_result = zope.location.location.located(result, context, key)
+ return located_result
# Convention to make adapter introspectable, used by apidoc
getAnnotation.factory = factory
More information about the Checkins
mailing list