--- a/src/pyams_utils/adapter.py Tue Sep 17 11:48:08 2019 +0200
+++ b/src/pyams_utils/adapter.py Wed Sep 18 19:36:57 2019 +0200
@@ -18,24 +18,21 @@
See :ref:`zca` to see how PyAMS can help components management.
"""
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
import logging
-logger = logging.getLogger('PyAMS (utils)')
import venusian
+from zope.annotation.interfaces import IAnnotations
+from zope.interface import alsoProvides, implementedBy
+from zope.lifecycleevent import ObjectCreatedEvent
+from zope.location import locate as zope_locate
-# import interfaces
-from zope.annotation.interfaces import IAnnotations
-
-# import packages
from pyams_utils.factory import get_object_factory, is_interface
from pyams_utils.registry import get_current_registry
-from zope.interface import implementedBy, alsoProvides, Interface
-from zope.lifecycleevent import ObjectCreatedEvent
-from zope.location import locate as zope_locate
+
+
+__docformat__ = 'restructuredtext'
+
+logger = logging.getLogger('PyAMS (utils)')
class ContextAdapter(object):
@@ -139,14 +136,17 @@
:param object context: context object which should be adapted
:param str key: annotations key to look for
:param factory: if annotations key is not found, this is the factory which will be used to
- create a new object; if factory is None and is requested object can't be found, None is returned
+ create a new object; factory can be a class or callable object, or an interface for which
+ a factory has been registered; if factory is None and is requested object can't be found,
+ None is returned
:param markers: if not None, list of marker interfaces which created adapter should provide
:param bool=True notify: if 'False', no notification event will be sent on object creation
:param bool=True locate: if 'False', the new object is not attached to any parent
- :param object=None parent: parent to which new object is attached
- :param str=None name: if locate is not False, this is the name with which the new object is attached
- to it's parent.
- :param callback: if not None, callback function which will be called after
+ :param object=None parent: parent to which new object is attached; if None, object is
+ attached to context
+ :param str=None name: if locate is not False, this is the name with which the new object is
+ attached to it's parent
+ :param callback: if not None, callback function which will be called after object creation
"""
annotations = IAnnotations(context, None)
if annotations is None: