From d0e632a291d99fad04f353fc9f21429c7acce4f8 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Wed, 20 Sep 2017 11:01:47 -0500 Subject: [PATCH 1/2] Clean up formatting in interfaces.py --- CHANGES.rst | 1 + src/nti/externalization/interfaces.py | 55 ++++++++++++++------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0958f3e..79e3136 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,3 +8,4 @@ - First PyPI release. - Add support for Python 3. +- Drop support for externalizing to plists. diff --git a/src/nti/externalization/interfaces.py b/src/nti/externalization/interfaces.py index bb55baf..c391f72 100644 --- a/src/nti/externalization/interfaces.py +++ b/src/nti/externalization/interfaces.py @@ -3,24 +3,29 @@ """ Externalization Interfaces -.. $Id$ """ from __future__ import print_function, absolute_import, division __docformat__ = "restructuredtext en" -logger = __import__('logging').getLogger(__name__) - from zope import interface from zope.component.interfaces import IFactory from zope.interface.common.mapping import IFullMapping - from zope.interface.common.sequence import ISequence from zope.location import ILocation +from zope.interface.interfaces import ObjectEvent +from zope.interface.interfaces import IObjectEvent + +from zope.lifecycleevent import ObjectModifiedEvent +from zope.lifecycleevent import IObjectModifiedEvent + + +# pylint:disable=inherit-non-class,no-method-argument,no-self-argument + class StandardExternalFields(object): """ @@ -92,7 +97,7 @@ class INonExternalizableReplacer(interface.Interface): some object cannot be externalized. """ - def __call__(obj): + def __call__(obj): # pylint:disable=signature-differs """ :return: An externalized object to replace the given object. Possibly the given object itself if some higher level will handle it. @@ -126,10 +131,11 @@ def decorateExternalObject(origial, external): though this is not guaranteed). :param original: The object that is being externalized. - Passed to facilitate using non-classes as decorators. + Passed to facilitate using non-classes as decorators. :param external: The externalization of that object, produced - by an implementation of :class:`~nti.externalization.interfaces.IInternalObjectExternalizer` or - default rules. + by an implementation of + :class:`~nti.externalization.interfaces.IInternalObjectExternalizer` + or default rules. :return: Undefined. """ @@ -153,11 +159,11 @@ def decorateExternalMapping(original, external): Decorate the externalized object mapping. :param original: The object that is being externalized. Passed - to facilitate using non-classes as decorators. + to facilitate using non-classes as decorators. :param external: The externalization of that object, an - :class:`~nti.externalization.interfaces.ILocatedExternalMapping`, - produced by an implementation of - :class:`~nti.externalization.interfaces.IInternalObjectExternalizer` or default rules. + :class:`~nti.externalization.interfaces.ILocatedExternalMapping`, + produced by an implementation of + :class:`~nti.externalization.interfaces.IInternalObjectExternalizer` or default rules. :return: Undefined. """ @@ -186,8 +192,10 @@ class ILocatedExternalSequence(IExternalizedObject, ILocation, ISequence): @interface.implementer(ILocatedExternalMapping) class LocatedExternalDict(dict): """ - A dictionary that implements :class:`~nti.externalization.interfaces.ILocatedExternalMapping`. Returned - by :func:`~nti.externalization.externalization.to_standard_external_dictionary`. + A dictionary that implements + :class:`~nti.externalization.interfaces.ILocatedExternalMapping`. + Returned by + :func:`~nti.externalization.externalization.to_standard_external_dictionary`. This class is not :class:`.IContentTypeAware`, and it indicates so explicitly by declaring a `mime_type` value of None. @@ -202,8 +210,10 @@ class LocatedExternalDict(dict): @interface.implementer(ILocatedExternalSequence) class LocatedExternalList(list): """ - A list that implements :class:`~nti.externalization.interfaces.ILocatedExternalSequence`. Returned - by :func:`~nti.externalization.externalization.to_external_object`. + A list that implements + :class:`~nti.externalization.interfaces.ILocatedExternalSequence`. + Returned by + :func:`~nti.externalization.externalization.to_external_object`. This class is not :class:`.IContentTypeAware`, and it indicates so explicitly by declaring a `mimeType` value of None. @@ -290,8 +300,9 @@ class IExternalizedObjectFactoryFinder(interface.Interface): def find_factory(externalized_object): """ - Given an externalized object, return a :class:`zope.component.interfaces.IFactory` to create the proper - internal types. + Given an externalized object, return a + :class:`zope.component.interfaces.IFactory` to create the + proper internal types. :return: An :class:`zope.component.interfaces.IFactory`, or :const:`None`. """ @@ -347,14 +358,6 @@ class IInternalObjectIO(IInternalObjectExternalizer, IInternalObjectUpdater): in external forms. """ - -from zope.interface.interfaces import ObjectEvent -from zope.interface.interfaces import IObjectEvent - -from zope.lifecycleevent import ObjectModifiedEvent -from zope.lifecycleevent import IObjectModifiedEvent - - class IObjectWillUpdateFromExternalEvent(IObjectEvent): """ An object will be updated from an external value. From 7889551d8a50482a1336f6823e22bbf59cf2ca32 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Wed, 20 Sep 2017 11:19:58 -0500 Subject: [PATCH 2/2] Drop support for plist. Fixes #21 --- CHANGES.rst | 3 +- docs/conf.py | 2 + src/nti/externalization/configure.zcml | 1 - src/nti/externalization/externalization.py | 13 ++--- src/nti/externalization/interfaces.py | 3 -- src/nti/externalization/internalization.py | 3 +- src/nti/externalization/representation.py | 53 +++---------------- .../tests/test_externalization.py | 12 ++--- 8 files changed, 18 insertions(+), 72 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 79e3136..f88f7ad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,4 +8,5 @@ - First PyPI release. - Add support for Python 3. -- Drop support for externalizing to plists. +- Drop support for externalizing to plists. See + https://github.com/NextThought/nti.externalization/issues/21 diff --git a/docs/conf.py b/docs/conf.py index 746256d..9a60e50 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -169,6 +169,8 @@ 'https://docs.python.org/': None, #'https://ntiwref.readthedocs.io/en/latest': None, 'https://persistent.readthedocs.io/en/latest': None, + 'https://zopecomponent.readthedocs.io/en/latest': None, + 'https://zodb.readthedocs.io/en/latest': None, } extlinks = { diff --git a/src/nti/externalization/configure.zcml b/src/nti/externalization/configure.zcml index 23ff82b..589d95c 100644 --- a/src/nti/externalization/configure.zcml +++ b/src/nti/externalization/configure.zcml @@ -35,7 +35,6 @@ -