1919from zope import interface
2020from zope import schema
2121from zope .component import getUtility
22- from zope .schema .interfaces import IDict
22+ from zope .schema .interfaces import IMapping
2323from zope .schema .interfaces import IObject
2424from zope .schema .interfaces import SchemaNotProvided
2525
4949StandardExternalFields = get_standard_external_fields ()
5050StandardInternalFields = get_standard_internal_fields ()
5151DEFAULT_EXTERNALIZATION_POLICY = get_default_externalization_policy ()
52- IDict_providedBy = IDict .providedBy
52+ IMapping_providedBy = IMapping .providedBy
5353IObject_providedBy = IObject .providedBy
5454
5555__all__ = [
@@ -694,13 +694,16 @@ def find_factory_for_named_value(self, key, value):
694694 remove this limitation is to subclass this object.
695695
696696 If no registered factory is found, and the schema field is
697- a `zope.schema.Dict ` with a value type of `zope.schema.Object`,
697+ a `zope.schema.Mapping ` with a value type of `zope.schema.Object`,
698698 then we return a factory which will update the object in place.
699699
700700 .. versionchanged:: 1.0a6
701701 Only return an anonymous factory for ``IDict`` fields when
702702 it wants objects for the value.
703703
704+ .. versionchanged:: NEXT
705+ Use ``IMapping`` instead of ``IDict`` to be more general.
706+
704707 """
705708 factory = AbstractDynamicObjectIO .find_factory_for_named_value (self , key , value )
706709 if factory is None : # pylint:disable=too-many-nested-blocks
@@ -727,12 +730,12 @@ def find_factory_for_named_value(self, key, value):
727730
728731 if (
729732 factory is None
730- and IDict_providedBy (field ) # pylint:disable=no-value-for-parameter
733+ and IMapping_providedBy (field ) # pylint:disable=no-value-for-parameter
731734 and isinstance (value , dict )
732735 and IObject_providedBy (field .value_type ) # pylint:disable=no-value-for-parameter
733736 ):
734- # If is no factory found, check to see if the
735- # schema field is a Dict with a complex value type, and if
737+ # If there is no factory found, check to see if the
738+ # schema field is a Mapping with a complex value type, and if
736739 # so, automatically update it in place. The alternative
737740 # requires the user to use a ZCML directive for each such
738741 # dict field.
0 commit comments