diff --git a/last_commit.txt b/last_commit.txt index c7fc39f699..076faff5e7 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,41 +1,12 @@ Repository: plone.app.content Branch: refs/heads/master -Date: 2015-03-18T15:13:55+01:00 +Date: 2015-03-18T20:06:37+01:00 Author: Gil Forcada (gforcada) -Commit: https://github.com/plone/plone.app.content/commit/6e45926c9a224587e45361f79e6ea19a5c6118ed +Commit: https://github.com/plone/plone.app.content/commit/bee0e17559dbb93a00e1d136b742839d9c80bb27 -Revert "Missing comma" +Revert "Revert "Merge pull request #26 from plone/jensens-cleanup"" -This reverts commit 01bec4a451bc5d0e9e7440b7581af1912b760939. - -Files changed: -M setup.py - -diff --git a/setup.py b/setup.py -index ccc116b..6edf0d1 100644 ---- a/setup.py -+++ b/setup.py -@@ -41,7 +41,7 @@ - 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate - 'Products.CMFPlone', - 'Zope2', -- 'plone.app.widgets>=2.0.0.dev0', -+ 'plone.app.widgets>=2.0.0.dev0' - 'plone.batching', - 'plone.i18n', - 'plone.memoize', - - -Repository: plone.app.content -Branch: refs/heads/master -Date: 2015-03-18T15:14:27+01:00 -Author: Gil Forcada (gforcada) -Commit: https://github.com/plone/plone.app.content/commit/054107b565b5cf38c3f7d9aaf901fe495f61c942 - -Revert "Merge pull request #26 from plone/jensens-cleanup" - -This reverts commit d349d5e4f7182d75727431017226e76b475742d1, reversing -changes made to 2e314054d9da46fd5fecc156f5edd8a92cc7fd01. +This reverts commit 054107b565b5cf38c3f7d9aaf901fe495f61c942. Files changed: M CHANGES.rst @@ -73,982 +44,1989 @@ M plone/app/content/utils.py M setup.py diff --git a/CHANGES.rst b/CHANGES.rst -index 1a5c263..787db48 100644 +index 787db48..1a5c263 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -4,12 +4,8 @@ Changelog +@@ -4,8 +4,12 @@ Changelog 3.0.3 (unreleased) ------------------ --- pep8, flake8, utf8-headers et al cleanup. -- [jensens] -+- Nothing changed yet. +-- Nothing changed yet. ++- pep8, flake8, utf8-headers et al cleanup. ++ [jensens] --- refactored ``p.a.c.namechooser.NormalizingNameChooser._getCheckId`` to not -- use lambdas. -- [jensens] ++- refactored ``p.a.c.namechooser.NormalizingNameChooser._getCheckId`` to not ++ use lambdas. ++ [jensens] 3.0.2 (2015-03-13) ------------------ diff --git a/plone/__init__.py b/plone/__init__.py -index 68c04af..f48ad10 100644 +index f48ad10..68c04af 100644 --- a/plone/__init__.py +++ b/plone/__init__.py -@@ -1,2 +1,6 @@ --# -*- coding: utf-8 -*- --__import__('pkg_resources').declare_namespace(__name__) -+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages -+try: -+ __import__('pkg_resources').declare_namespace(__name__) -+except ImportError: -+ from pkgutil import extend_path -+ __path__ = extend_path(__path__, __name__) +@@ -1,6 +1,2 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- ++__import__('pkg_resources').declare_namespace(__name__) diff --git a/plone/app/__init__.py b/plone/app/__init__.py -index 68c04af..f48ad10 100644 +index f48ad10..68c04af 100644 --- a/plone/app/__init__.py +++ b/plone/app/__init__.py -@@ -1,2 +1,6 @@ --# -*- coding: utf-8 -*- --__import__('pkg_resources').declare_namespace(__name__) -+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages -+try: -+ __import__('pkg_resources').declare_namespace(__name__) -+except ImportError: -+ from pkgutil import extend_path -+ __path__ = extend_path(__path__, __name__) +@@ -1,6 +1,2 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- ++__import__('pkg_resources').declare_namespace(__name__) diff --git a/plone/app/content/__init__.py b/plone/app/content/__init__.py -index 40a96af..f48ad10 100644 +index f48ad10..40a96af 100644 --- a/plone/app/content/__init__.py +++ b/plone/app/content/__init__.py -@@ -1 +1,6 @@ --# -*- coding: utf-8 -*- -+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages -+try: -+ __import__('pkg_resources').declare_namespace(__name__) -+except ImportError: -+ from pkgutil import extend_path -+ __path__ = extend_path(__path__, __name__) +@@ -1,6 +1 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- diff --git a/plone/app/content/browser/__init__.py b/plone/app/content/browser/__init__.py -index 40a96af..e69de29 100644 +index e69de29..40a96af 100644 --- a/plone/app/content/browser/__init__.py +++ b/plone/app/content/browser/__init__.py -@@ -1 +0,0 @@ --# -*- coding: utf-8 -*- +@@ -0,0 +1 @@ ++# -*- coding: utf-8 -*- diff --git a/plone/app/content/browser/actions.py b/plone/app/content/browser/actions.py -index 3a3b63b..c5dc0bc 100644 +index c5dc0bc..3a3b63b 100644 --- a/plone/app/content/browser/actions.py +++ b/plone/app/content/browser/actions.py @@ -9,11 +9,11 @@ from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from Products.statusmessages.interfaces import IStatusMessage from ZODB.POSException import ConflictError -+from zExceptions import Unauthorized +-from zExceptions import Unauthorized from z3c.form import button from z3c.form import field from z3c.form import form from z3c.form.widget import ComputedWidgetAttribute --from zExceptions import Unauthorized ++from zExceptions import Unauthorized from zope import schema from zope.component import getMultiAdapter from zope.component import queryMultiAdapter diff --git a/plone/app/content/browser/adding.py b/plone/app/content/browser/adding.py -index 26bed83..725c1c5 100644 +index 725c1c5..26bed83 100644 --- a/plone/app/content/browser/adding.py +++ b/plone/app/content/browser/adding.py -@@ -1,4 +1,3 @@ --# -*- coding: utf-8 -*- +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- from Acquisition import Implicit from Products.CMFCore.utils import getToolByName from Products.Five.browser.adding import ContentAdding diff --git a/plone/app/content/browser/constraintypes.py b/plone/app/content/browser/constraintypes.py -index cc81e23..78db1ab 100644 +index 78db1ab..2869949 100644 --- a/plone/app/content/browser/constraintypes.py +++ b/plone/app/content/browser/constraintypes.py -@@ -1,52 +1,32 @@ --# -*- coding: utf-8 -*- -+from plone.autoform.form import AutoExtensibleForm +@@ -1,32 +1,46 @@ +-from plone.autoform.form import AutoExtensibleForm ++# -*- coding: utf-8 -*- from Products.CMFPlone import PloneMessageFactory as PC_ from Products.CMFPlone.interfaces import ISelectableConstrainTypes from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile --from plone.autoform.form import AutoExtensibleForm ++from plone.autoform.form import AutoExtensibleForm from z3c.form import button from z3c.form import form from z3c.form.browser.checkbox import CheckBoxFieldWidget --from zope.interface import Interface - from zope.interface import implementer -+from zope.interface import Interface +-from zope.interface import implementer + from zope.interface import Interface ++from zope.interface import implementer from zope.interface import invariant from zope.interface.exceptions import Invalid --from zope.schema import Choice --from zope.schema import List -+from zope.schema import List, Choice +-from zope.schema import List, Choice ++from zope.schema import Choice ++from zope.schema import List from zope.schema.interfaces import IVocabularyFactory --from zope.schema.vocabulary import SimpleTerm --from zope.schema.vocabulary import SimpleVocabulary -+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm +-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm ++from zope.schema.vocabulary import SimpleTerm ++from zope.schema.vocabulary import SimpleVocabulary # XXX --# acquire locallyAllowedTypes from parent (default) --ACQUIRE = -1 -- --# use default behavior of PortalFolder which uses the FTI information --DISABLED = 0 -- --# allow types from locallyAllowedTypes only --ENABLED = 1 -- -- --def ST(key, txt, default): -- SimpleTerm(value=key, title=PC_(txt, default=default)) -- --possible_constrain_types = SimpleVocabulary([ -- ST( -- ACQUIRE, -- u'constraintypes_mode_acquire', -- u'Use parent folder settings' -- ), -- ST( -- DISABLED, -- 'label_constraintypes_allow_standard', -- u'Use portal default' -- ), -- ST( -- ENABLED, -- u'label_constraintypes_specify_manually', -- u'Select manually' -- ) --]) -+ACQUIRE = -1 # acquire locallyAllowedTypes from parent (default) -+DISABLED = 0 # use default behavior of PortalFolder which uses the -+ # FTI information -+ENABLED = 1 # allow types from locallyAllowedTypes only +-ACQUIRE = -1 # acquire locallyAllowedTypes from parent (default) +-DISABLED = 0 # use default behavior of PortalFolder which uses the +- # FTI information +-ENABLED = 1 # allow types from locallyAllowedTypes only ++# acquire locallyAllowedTypes from parent (default) ++ACQUIRE = -1 ++ ++# use default behavior of PortalFolder which uses the FTI information ++DISABLED = 0 ++ ++# allow types from locallyAllowedTypes only ++ENABLED = 1 + -+ST = lambda key, txt, default: SimpleTerm(value=key, -+ title=PC_(txt, default=default)) -+possible_constrain_types = SimpleVocabulary( -+ [ST(ACQUIRE, u'constraintypes_mode_acquire', -+ u'Use parent folder settings'), -+ ST(DISABLED, 'label_constraintypes_allow_standard', u'Use portal default'), -+ ST(ENABLED, u'label_constraintypes_specify_manually', u'Select manually') -+ ]) + + ST = lambda key, txt, default: SimpleTerm(value=key, + title=PC_(txt, default=default)) +-possible_constrain_types = SimpleVocabulary( +- [ST(ACQUIRE, u'constraintypes_mode_acquire', +- u'Use parent folder settings'), +- ST(DISABLED, 'label_constraintypes_allow_standard', u'Use portal default'), +- ST(ENABLED, u'label_constraintypes_specify_manually', u'Select manually') +- ]) ++ ++possible_constrain_types = SimpleVocabulary([ ++ ST(ACQUIRE, ++ u'constraintypes_mode_acquire', ++ u'Use parent folder settings'), ++ ST(DISABLED, ++ 'label_constraintypes_allow_standard', ++ u'Use portal default'), ++ ST(ENABLED, ++ u'label_constraintypes_specify_manually', ++ u'Select manually') ++]) @implementer(IVocabularyFactory) diff --git a/plone/app/content/browser/content_status_history.py b/plone/app/content/browser/content_status_history.py -index 34a265a..59d78d3 100644 +index 59d78d3..34a265a 100644 --- a/plone/app/content/browser/content_status_history.py +++ b/plone/app/content/browser/content_status_history.py -@@ -1,13 +1,11 @@ --# -*- coding: utf-8 -*- +@@ -1,11 +1,13 @@ ++# -*- coding: utf-8 -*- from Products.CMFCore.utils import getToolByName from Products.CMFPlone import PloneMessageFactory as _ from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile --from z3c.form import field --from z3c.form import form --from zope.interface import Interface - from zope.publisher.browser import BrowserView -+from zope.interface import Interface +-from zope.publisher.browser import BrowserView ++from z3c.form import field ++from z3c.form import form + from zope.interface import Interface ++from zope.publisher.browser import BrowserView from zope.schema import Datetime from zope.schema.fieldproperty import FieldProperty -+from z3c.form import form, field +-from z3c.form import form, field class IContentStatusHistoryDates(Interface): -@@ -17,22 +15,18 @@ class IContentStatusHistoryDates(Interface): +@@ -15,18 +17,22 @@ class IContentStatusHistoryDates(Interface): effective_date = Datetime( title=_(u"label_effective_date", default=u"Publishing Date"), -- description=_( -- u"help_effective_date", -- default=u"The date when the item will be published. If no " -- u"date is selected the item will be published immediately." -- ), -+ description=_(u"help_effective_date", -+ default=u"The date when the item will be published. If no " -+ u"date is selected the item will be published immediately."), +- description=_(u"help_effective_date", +- default=u"The date when the item will be published. If no " +- u"date is selected the item will be published immediately."), ++ description=_( ++ u"help_effective_date", ++ default=u"The date when the item will be published. If no " ++ u"date is selected the item will be published immediately." ++ ), required=False) expiration_date = Datetime( title=_(u"label_expiration_date", default=u"Expiration Date"), -- description=_( -- u"help_expiration_date", -- default=u"The date when the item expires. This will automatically " -- u"make the item invisible for others at the given date." -- u"If no date is chosen, it will never expire." -- ), -+ description=_(u"help_expiration_date", -+ default=u"The date when the item expires. This will automatically " -+ u"make the item invisible for others at the given date." -+ u"If no date is chosen, it will never expire."), +- description=_(u"help_expiration_date", +- default=u"The date when the item expires. This will automatically " +- u"make the item invisible for others at the given date." +- u"If no date is chosen, it will never expire."), ++ description=_( ++ u"help_expiration_date", ++ default=u"The date when the item expires. This will automatically " ++ u"make the item invisible for others at the given date." ++ u"If no date is chosen, it will never expire." ++ ), required=False) -@@ -41,12 +35,8 @@ class ContentStatusHistoryDatesForm(form.Form): +@@ -35,8 +41,12 @@ class ContentStatusHistoryDatesForm(form.Form): ignoreContext = True label = "Content status history dates" -- effective_date = FieldProperty( -- IContentStatusHistoryDates['effective_date'] -- ) -- expiration_date = FieldProperty( -- IContentStatusHistoryDates['expiration_date'] -- ) -+ effective_date = FieldProperty(IContentStatusHistoryDates['effective_date']) -+ expiration_date = FieldProperty(IContentStatusHistoryDates['expiration_date']) +- effective_date = FieldProperty(IContentStatusHistoryDates['effective_date']) +- expiration_date = FieldProperty(IContentStatusHistoryDates['expiration_date']) ++ effective_date = FieldProperty( ++ IContentStatusHistoryDates['effective_date'] ++ ) ++ expiration_date = FieldProperty( ++ IContentStatusHistoryDates['expiration_date'] ++ ) class ContentStatusHistoryView(BrowserView): -@@ -66,17 +56,11 @@ def __call__(self, workflow_action=None, paths=[], comment="", +@@ -56,11 +66,17 @@ def __call__(self, workflow_action=None, paths=[], comment="", include_children=False, *args): data = self.dates_form.extractData() -- if self.request.get('form.widgets.effective_date-calendar', None) \ -- and data: -- effective_date = data[0]['effective_date'].strftime( -- "%Y-%m-%d %H:%M" -- ) -- -- if self.request.get('form.widgets.expiration_date-calendar', None) \ -- and data: -- expiration_date = data[0]['expiration_date'].strftime( -- "%Y-%m-%d %H:%M" -- ) -+ if self.request.get('form.widgets.effective_date-calendar', None) and data: -+ effective_date = data[0]['effective_date'].strftime("%Y-%m-%d %H:%M") +- if self.request.get('form.widgets.effective_date-calendar', None) and data: +- effective_date = data[0]['effective_date'].strftime("%Y-%m-%d %H:%M") +- +- if self.request.get('form.widgets.expiration_date-calendar', None) and data: +- expiration_date = data[0]['expiration_date'].strftime("%Y-%m-%d %H:%M") ++ if self.request.get('form.widgets.effective_date-calendar', None) \ ++ and data: ++ effective_date = data[0]['effective_date'].strftime( ++ "%Y-%m-%d %H:%M" ++ ) + -+ if self.request.get('form.widgets.expiration_date-calendar', None) and data: -+ expiration_date = data[0]['expiration_date'].strftime("%Y-%m-%d %H:%M") ++ if self.request.get('form.widgets.expiration_date-calendar', None) \ ++ and data: ++ expiration_date = data[0]['expiration_date'].strftime( ++ "%Y-%m-%d %H:%M" ++ ) if self.request.get('form.button.Cancel', None): return self.request.RESPONSE.redirect( diff --git a/plone/app/content/browser/file.py b/plone/app/content/browser/file.py -index 0d579c2..7598fd5 100644 +index 7598fd5..0d579c2 100644 --- a/plone/app/content/browser/file.py +++ b/plone/app/content/browser/file.py @@ -1,13 +1,13 @@ --# -*- coding: utf-8 -*- ++# -*- coding: utf-8 -*- from Products.CMFCore.utils import getToolByName from Products.Five.browser import BrowserView --from plone.app.dexterity.interfaces import IDXFileFactory +- +-import json +-import mimetypes -from plone.dexterity.interfaces import IDexterityFTI --from plone.uuid.interfaces import IUUID -+ - import json --import logging - import mimetypes + from plone.app.dexterity.interfaces import IDXFileFactory +from plone.dexterity.interfaces import IDexterityFTI -+from plone.app.dexterity.interfaces import IDXFileFactory -+from plone.uuid.interfaces import IUUID - import os -+import logging + from plone.uuid.interfaces import IUUID +-import os ++import json + import logging ++import mimetypes ++import os logger = logging.getLogger('plone') diff --git a/plone/app/content/browser/folder.py b/plone/app/content/browser/folder.py -index f462a8f..b621cba 100644 +index b621cba..d497bac 100644 --- a/plone/app/content/browser/folder.py +++ b/plone/app/content/browser/folder.py @@ -1,4 +1,4 @@ --# -*- coding: utf-8 -*- -+from .interfaces import IFolderContentsView +-from .interfaces import IFolderContentsView ++# -*- coding: utf-8 -*- from AccessControl import Unauthorized from AccessControl import getSecurityManager from Acquisition import aq_inner -@@ -12,9 +12,7 @@ +@@ -12,7 +12,9 @@ from Products.CMFPlone.interfaces.siteroot import IPloneSiteRoot from Products.Five import BrowserView from ZODB.POSException import ConflictError --from plone.app.content.interfaces import IFolderContentsView --from plone.app.content.utils import json_dumps --from plone.app.content.utils import json_loads -+from plone.app.content.utils import json_dumps, json_loads +-from plone.app.content.utils import json_dumps, json_loads ++from plone.app.content.browser.interfaces import IFolderContentsView ++from plone.app.content.utils import json_dumps ++from plone.app.content.utils import json_loads from plone.dexterity.interfaces import IDexterityContent from plone.folder.interfaces import IExplicitOrdering from plone.protect.postonly import check as checkpost -@@ -25,7 +23,7 @@ +@@ -23,7 +25,7 @@ from zope.component.hooks import getSite from zope.container.interfaces import INameChooser from zope.event import notify --from zope.interface import implementer -+from zope.interface import implements +-from zope.interface import implements ++from zope.interface import implementer from zope.lifecycleevent import ObjectModifiedEvent import transaction -@@ -36,8 +34,8 @@ +@@ -34,8 +36,8 @@ TUS_ENABLED = False --@implementer(IFolderContentsView) ++@implementer(IFolderContentsView) class FolderContentsView(BrowserView): -+ implements(IFolderContentsView) +- implements(IFolderContentsView) def __call__(self): site = getSite() diff --git a/plone/app/content/browser/folderfactories.py b/plone/app/content/browser/folderfactories.py -index 088583b..97ee853 100644 +index 97ee853..088583b 100644 --- a/plone/app/content/browser/folderfactories.py +++ b/plone/app/content/browser/folderfactories.py @@ -1,18 +1,18 @@ --# -*- coding: utf-8 -*- -+from urllib import quote_plus -+ -+from plone.i18n.normalizer.interfaces import IIDNormalizer -+from plone.memoize.instance import memoize -+from plone.memoize.request import memoize_diy_request -+from zope.component import getMultiAdapter, queryUtility -+from zope.i18n import translate -+from zope.publisher.browser import BrowserView -+ +-from urllib import quote_plus +- +-from plone.i18n.normalizer.interfaces import IIDNormalizer +-from plone.memoize.instance import memoize +-from plone.memoize.request import memoize_diy_request +-from zope.component import getMultiAdapter, queryUtility +-from zope.i18n import translate +-from zope.publisher.browser import BrowserView +- ++# -*- coding: utf-8 -*- from Acquisition import aq_inner from Acquisition import aq_parent from Products.CMFCore.Expression import createExprContext from Products.CMFCore.utils import getToolByName from Products.CMFPlone.interfaces.constrains import ISelectableConstrainTypes from plone.app.content.browser.interfaces import IFolderContentsView --from plone.i18n.normalizer.interfaces import IIDNormalizer --from plone.memoize.instance import memoize --from plone.memoize.request import memoize_diy_request --from urllib import quote_plus --from zope.component import getMultiAdapter --from zope.component import queryUtility --from zope.i18n import translate --from zope.publisher.browser import BrowserView ++from plone.i18n.normalizer.interfaces import IIDNormalizer ++from plone.memoize.instance import memoize ++from plone.memoize.request import memoize_diy_request ++from urllib import quote_plus ++from zope.component import getMultiAdapter ++from zope.component import queryUtility ++from zope.i18n import translate ++from zope.publisher.browser import BrowserView @memoize_diy_request(arg=0) diff --git a/plone/app/content/browser/i18n.py b/plone/app/content/browser/i18n.py -index 8909b4e..612b510 100644 +index 612b510..8909b4e 100644 --- a/plone/app/content/browser/i18n.py +++ b/plone/app/content/browser/i18n.py -@@ -1,9 +1,10 @@ --# -*- coding: utf-8 -*- --from Products.Five.browser import BrowserView -+import json -+ +@@ -1,10 +1,9 @@ +-import json +- ++# -*- coding: utf-8 -*- ++from Products.Five.browser import BrowserView from plone.memoize import ram from zope.component import queryUtility from zope.i18n.interfaces import ITranslationDomain --import json -+ -+from Products.Five.browser import BrowserView +- +-from Products.Five.browser import BrowserView ++import json def _cache_key(method, self, domain, language): -@@ -34,4 +35,4 @@ def __call__(self, domain, language=None): +@@ -35,4 +34,4 @@ def __call__(self, domain, language=None): response = self.request.response response.setHeader('content-type', 'application/json') response.setBody(json.dumps(catalog)) - return response -+ return response \ No newline at end of file ++ return response diff --git a/plone/app/content/browser/interfaces.py b/plone/app/content/browser/interfaces.py -index 3a558a6..df1a648 100644 +index df1a648..3a558a6 100644 --- a/plone/app/content/browser/interfaces.py +++ b/plone/app/content/browser/interfaces.py @@ -1,4 +1,4 @@ --# -*- coding: utf-8 -*- -+# Zope imports +-# Zope imports ++# -*- coding: utf-8 -*- from zope.interface import Interface from zope.viewlet.interfaces import IViewletManager diff --git a/plone/app/content/browser/query.py b/plone/app/content/browser/query.py -index 9834029..91dc9d1 100644 +index 91dc9d1..9834029 100644 --- a/plone/app/content/browser/query.py +++ b/plone/app/content/browser/query.py -@@ -1,9 +1,8 @@ --# -*- coding: utf-8 -*- --from Products.Five import BrowserView --from plone.app.querystring.interfaces import IQuerystringRegistryReader -+import json - from plone.registry.interfaces import IRegistry -+from plone.app.querystring.interfaces import IQuerystringRegistryReader - from zope.component import getUtility +@@ -1,8 +1,9 @@ -import json +-from plone.registry.interfaces import IRegistry ++# -*- coding: utf-8 -*- +from Products.Five import BrowserView + from plone.app.querystring.interfaces import IQuerystringRegistryReader ++from plone.registry.interfaces import IRegistry + from zope.component import getUtility +-from Products.Five import BrowserView ++import json class QueryStringIndexOptions(BrowserView): diff --git a/plone/app/content/browser/reviewlist.py b/plone/app/content/browser/reviewlist.py -index 97104c3..eb17ec7 100644 +index eb17ec7..97104c3 100644 --- a/plone/app/content/browser/reviewlist.py +++ b/plone/app/content/browser/reviewlist.py @@ -1,13 +1,13 @@ --# -*- coding: utf-8 -*- --from Acquisition import aq_inner --from Products.CMFCore.utils import getToolByName --from Products.CMFPlone.utils import safe_unicode --from plone.app.content.browser.tableview import Table --from plone.app.content.browser.tableview import TableBrowserView -+import urllib -+ - from zope.component import getMultiAdapter - from zope.i18n import translate - from zope.publisher.browser import BrowserView -import urllib -+ -+from Acquisition import aq_inner -+from Products.CMFCore.utils import getToolByName -+from Products.CMFPlone.utils import safe_unicode -+from plone.app.content.browser.tableview import Table, TableBrowserView +- +-from zope.component import getMultiAdapter +-from zope.i18n import translate +-from zope.publisher.browser import BrowserView +- ++# -*- coding: utf-8 -*- + from Acquisition import aq_inner + from Products.CMFCore.utils import getToolByName + from Products.CMFPlone.utils import safe_unicode +-from plone.app.content.browser.tableview import Table, TableBrowserView ++from plone.app.content.browser.tableview import Table ++from plone.app.content.browser.tableview import TableBrowserView ++from zope.component import getMultiAdapter ++from zope.i18n import translate ++from zope.publisher.browser import BrowserView ++import urllib class FullReviewListView(BrowserView): diff --git a/plone/app/content/browser/selection.py b/plone/app/content/browser/selection.py -index 99e8d47..bc083ee 100644 +index bc083ee..99e8d47 100644 --- a/plone/app/content/browser/selection.py +++ b/plone/app/content/browser/selection.py -@@ -1,9 +1,8 @@ --# -*- coding: utf-8 -*- +@@ -1,8 +1,9 @@ ++# -*- coding: utf-8 -*- from Acquisition import aq_inner --from Products.CMFCore.utils import getToolByName - from Products.CMFPlone import PloneMessageFactory as _ --from Products.Five.browser import BrowserView - from Products.statusmessages.interfaces import IStatusMessage -+from Products.CMFCore.utils import getToolByName -+from Products.Five.browser import BrowserView +-from Products.CMFPlone import PloneMessageFactory as _ +-from Products.statusmessages.interfaces import IStatusMessage + from Products.CMFCore.utils import getToolByName ++from Products.CMFPlone import PloneMessageFactory as _ + from Products.Five.browser import BrowserView ++from Products.statusmessages.interfaces import IStatusMessage from zope.component import getMultiAdapter diff --git a/plone/app/content/browser/tableview.py b/plone/app/content/browser/tableview.py -index 36b76ab..1b90f16 100644 +index 1b90f16..36b76ab 100644 --- a/plone/app/content/browser/tableview.py +++ b/plone/app/content/browser/tableview.py -@@ -1,16 +1,22 @@ --# -*- coding: utf-8 -*- --from Products.CMFPlone.utils import safe_unicode -+import urllib -+ -+from plone.memoize import instance -+ +@@ -1,22 +1,16 @@ +-import urllib +- +-from plone.memoize import instance +- ++# -*- coding: utf-8 -*- ++from Products.CMFPlone.utils import safe_unicode from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile --from ZTUtils import make_query -+ +- ++from ZTUtils import make_query from plone.batching import Batch --from plone.batching.browser import BatchView --from plone.memoize import instance -+ +- ++from plone.batching.browser import BatchView ++from plone.memoize import instance from zope.i18nmessageid import MessageFactory --from zope.publisher.browser import BrowserView --import urllib -+ -+from Products.CMFPlone.utils import safe_unicode +- +-from Products.CMFPlone.utils import safe_unicode ++from zope.publisher.browser import BrowserView ++import urllib _ = MessageFactory('plone') -+from ZTUtils import make_query -+ -+from plone.batching.browser import BatchView -+from zope.publisher.browser import BrowserView -+ +-from ZTUtils import make_query +- +-from plone.batching.browser import BatchView +-from zope.publisher.browser import BrowserView +- class TableBatchView(BatchView): diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py -index 3caeba5..6bc2bde 100644 +index 6bc2bde..3caeba5 100644 --- a/plone/app/content/browser/vocabulary.py +++ b/plone/app/content/browser/vocabulary.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -+ +- from AccessControl import getSecurityManager from Products.CMFCore.utils import getToolByName from Products.CMFPlone.interfaces import IPloneSiteRoot from Products.Five import BrowserView from logging import getLogger --from plone.app.content.utils import json_dumps --from plone.app.content.utils import json_loads -+from plone.app.content.utils import json_loads, json_dumps +-from plone.app.content.utils import json_loads, json_dumps ++from plone.app.content.utils import json_dumps ++from plone.app.content.utils import json_loads from plone.app.querystring import queryparser from plone.app.widgets.interfaces import IFieldPermissionChecker from plone.autoform.interfaces import WRITE_PERMISSIONS_KEY diff --git a/plone/app/content/catalog.py b/plone/app/content/catalog.py -index 632448c..5ae53f1 100644 +index 5ae53f1..632448c 100644 --- a/plone/app/content/catalog.py +++ b/plone/app/content/catalog.py -@@ -1,4 +1,3 @@ --# -*- coding: utf-8 -*- +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- def reindexOnModify(content, event): diff --git a/plone/app/content/container.py b/plone/app/content/container.py -index 1f083b0..0783f2b 100644 +index 0783f2b..1f083b0 100644 --- a/plone/app/content/container.py +++ b/plone/app/content/container.py -@@ -1,21 +1,23 @@ --# -*- coding: utf-8 -*- --from Products.CMFCore.CMFCatalogAware import CMFCatalogAware -+from zope.container.interfaces import IContainer -+from zope.container.contained import Contained -+from zope.interface import implements -+ +@@ -1,23 +1,21 @@ +-from zope.container.interfaces import IContainer +-from zope.container.contained import Contained +-from zope.interface import implements +- ++# -*- coding: utf-8 -*- ++from Products.CMFCore.CMFCatalogAware import CMFCatalogAware from Products.CMFCore.PortalContent import PortalContent from Products.CMFCore.PortalFolder import PortalFolderBase -+from Products.CMFCore.CMFCatalogAware import CMFCatalogAware +-from Products.CMFCore.CMFCatalogAware import CMFCatalogAware from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl -+ +- from plone.app.content.interfaces import IReindexOnModify --from zope.container.contained import Contained --from zope.container.interfaces import IContainer --from zope.interface import implementer ++from zope.container.contained import Contained ++from zope.container.interfaces import IContainer ++from zope.interface import implementer --@implementer(IContainer) ++@implementer(IContainer) class OFSContainer(object): """A folder that's also a container. Borrowed in part from megrok.five. """ -+ implements(IContainer) -+ +- implements(IContainer) +- isPrincipiaFolderish = 1 def __init__(self, id=None): -@@ -67,14 +69,14 @@ def __len__(self): +@@ -69,14 +67,14 @@ def __len__(self): # # ... I WANT AN ADAPTER! -- --@implementer(IReindexOnModify) ++ ++@implementer(IReindexOnModify) class Container(OFSContainer, CMFCatalogAware, PortalFolderBase, PortalContent, DefaultDublinCoreImpl, Contained): """A base class mixing in CMFish, contentish, containerish, containedish, dublincoreish behaviour. """ -+ implements(IReindexOnModify) -+ +- implements(IReindexOnModify) +- def __init__(self, id=None, **kwargs): OFSContainer.__init__(self, id, **kwargs) PortalFolderBase.__init__(self, id, **kwargs) diff --git a/plone/app/content/interfaces.py b/plone/app/content/interfaces.py -index b51e45a..b08d66f 100644 +index b08d66f..b51e45a 100644 --- a/plone/app/content/interfaces.py +++ b/plone/app/content/interfaces.py -@@ -1,20 +1,36 @@ --# -*- coding: utf-8 -*- --from zope import schema - from zope.interface import Interface -+from zope import schema +@@ -1,36 +1,20 @@ +-from zope.interface import Interface ++# -*- coding: utf-8 -*- + from zope import schema ++from zope.interface import Interface class INameFromTitle(Interface): """An object that supports gettings it name from its title. """ -- title = schema.TextLine( -- title=u"Title", -- description=u"A title, which will be converted to a name", -- required=True -- ) -+ title = schema.TextLine(title=u"Title", -+ description=u"A title, which will be converted to " -+ u"a name", -+ required=True) +- title = schema.TextLine(title=u"Title", +- description=u"A title, which will be converted to " +- u"a name", +- required=True) ++ title = schema.TextLine( ++ title=u"Title", ++ description=u"A title, which will be converted to a name", ++ required=True ++ ) class IReindexOnModify(Interface): """Marker interface which makes sure an object gets reindexed when it's modified. """ -+ -+# XXX: This should be deprecated and removed in Plone 4. -+ -+class IIndexableObjectWrapper(Interface): -+ """An adapter of a (object, portal) where object is to be indexed in -+ portal_catalog. -+ -+ This should implement __getattr__(), which in turn should react -+ when the catalog tries to get attributes to index. -+ -+ The update() method must be called before the catalog is given the -+ wrapper. -+ """ -+ -+ def update(vars, **kwargs): -+ """Update the wrapper with variables from e.g. the workflow -+ tool. -+ """ +- +-# XXX: This should be deprecated and removed in Plone 4. +- +-class IIndexableObjectWrapper(Interface): +- """An adapter of a (object, portal) where object is to be indexed in +- portal_catalog. +- +- This should implement __getattr__(), which in turn should react +- when the catalog tries to get attributes to index. +- +- The update() method must be called before the catalog is given the +- wrapper. +- """ +- +- def update(vars, **kwargs): +- """Update the wrapper with variables from e.g. the workflow +- tool. +- """ diff --git a/plone/app/content/item.py b/plone/app/content/item.py -index 46b95f8..7a7478b 100644 +index 7a7478b..46b95f8 100644 --- a/plone/app/content/item.py +++ b/plone/app/content/item.py -@@ -1,16 +1,18 @@ --# -*- coding: utf-8 -*- -+from zope.container.contained import Contained -+from zope.interface import implements -+ +@@ -1,18 +1,16 @@ +-from zope.container.contained import Contained +-from zope.interface import implements +- ++# -*- coding: utf-8 -*- from Products.CMFCore.PortalContent import PortalContent from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl -+ +- from plone.app.content.interfaces import IReindexOnModify --from zope.container.contained import Contained --from zope.interface import implementer ++from zope.container.contained import Contained ++from zope.interface import implementer --@implementer(IReindexOnModify) ++@implementer(IReindexOnModify) class Item(PortalContent, DefaultDublinCoreImpl, Contained): """A non-containerish, CMFish item """ -+ implements(IReindexOnModify) -+ +- implements(IReindexOnModify) +- def __init__(self, id=None, **kwargs): DefaultDublinCoreImpl.__init__(self, **kwargs) if id is not None: diff --git a/plone/app/content/namechooser.py b/plone/app/content/namechooser.py -index 51ba0f5..b5fd297 100644 +index b5fd297..51ba0f5 100644 --- a/plone/app/content/namechooser.py +++ b/plone/app/content/namechooser.py -@@ -1,20 +1,19 @@ --# -*- coding: utf-8 -*- --from Acquisition import aq_base --from Acquisition import aq_inner --from plone.app.content.interfaces import INameFromTitle +@@ -1,19 +1,20 @@ ++# -*- coding: utf-8 -*- ++from Acquisition import aq_base ++from Acquisition import aq_inner ++from plone.app.content.interfaces import INameFromTitle from plone.i18n.normalizer import FILENAME_REGEX --from plone.i18n.normalizer.interfaces import IURLNormalizer - from plone.i18n.normalizer.interfaces import IUserPreferredURLNormalizer --from zExceptions import BadRequest -+from plone.i18n.normalizer.interfaces import IURLNormalizer +-from plone.i18n.normalizer.interfaces import IUserPreferredURLNormalizer + from plone.i18n.normalizer.interfaces import IURLNormalizer ++from plone.i18n.normalizer.interfaces import IUserPreferredURLNormalizer ++from zExceptions import BadRequest from zope.component import getUtility from zope.container.interfaces import INameChooser --from zope.interface import implementer -+from zope.interface import implements -+ -+from Acquisition import aq_inner, aq_base -+from zExceptions import BadRequest -+ -+from plone.app.content.interfaces import INameFromTitle +-from zope.interface import implements +- +-from Acquisition import aq_inner, aq_base +-from zExceptions import BadRequest +- +-from plone.app.content.interfaces import INameFromTitle ++from zope.interface import implementer import time ATTEMPTS = 100 --@implementer(INameChooser) ++@implementer(INameChooser) class NormalizingNameChooser(object): """A name chooser for a Zope object manager. -@@ -22,6 +21,8 @@ class NormalizingNameChooser(object): +@@ -21,8 +22,6 @@ class NormalizingNameChooser(object): title to generate a name. """ -+ implements(INameChooser) -+ +- implements(INameChooser) +- def __init__(self, context): self.context = context -@@ -92,18 +93,15 @@ def _getCheckId(self, obj): +@@ -93,15 +92,18 @@ def _getCheckId(self, obj): """ parent = aq_inner(self.context) _check_id = getattr(obj, 'check_id', None) -- -- def do_Plone_check(newid, required): -- if _check_id is not None: -- return _check_id( -- newid, -- required=required, -- contained_by=parent -- ) -- # fallback to OFS -- try: -- parent._checkId(newid) -- except BadRequest: -- return True -- -- return do_Plone_check -+ if _check_id is not None: -+ def do_Plone_check(id, required): -+ return _check_id(id, required=required, contained_by=parent) -+ check_id = lambda id, required: do_Plone_check(id, required) -+ else: -+ def do_OFS_check(parent, id): -+ try: -+ parent._checkId(id) -+ except BadRequest: -+ return True -+ check_id = lambda id, required: do_OFS_check(parent, id) -+ return check_id +- if _check_id is not None: +- def do_Plone_check(id, required): +- return _check_id(id, required=required, contained_by=parent) +- check_id = lambda id, required: do_Plone_check(id, required) +- else: +- def do_OFS_check(parent, id): +- try: +- parent._checkId(id) +- except BadRequest: +- return True +- check_id = lambda id, required: do_OFS_check(parent, id) +- return check_id ++ ++ def do_Plone_check(newid, required): ++ if _check_id is not None: ++ return _check_id( ++ newid, ++ required=required, ++ contained_by=parent ++ ) ++ # fallback to OFS ++ try: ++ parent._checkId(newid) ++ except BadRequest: ++ return True ++ ++ return do_Plone_check diff --git a/plone/app/content/tests/test_adding.py b/plone/app/content/tests/test_adding.py -index 3df20b0..97131f7 100644 +index 97131f7..3df20b0 100644 --- a/plone/app/content/tests/test_adding.py +++ b/plone/app/content/tests/test_adding.py -@@ -1,4 +1,3 @@ --# -*- coding: utf-8 -*- +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- from Acquisition import aq_get from plone.app.testing.bbb import PloneTestCase diff --git a/plone/app/content/tests/test_basecontent.py b/plone/app/content/tests/test_basecontent.py -index c8ac5ab..7a8f678 100644 +index 7a8f678..c8ac5ab 100644 --- a/plone/app/content/tests/test_basecontent.py +++ b/plone/app/content/tests/test_basecontent.py -@@ -1,15 +1,16 @@ --# -*- coding: utf-8 -*- --from Testing import ZopeTestCase as ztc --from plone.app.content.tests.base import ContentFunctionalTestCase +@@ -1,16 +1,15 @@ +-import unittest -import doctest - import unittest +- ++# -*- coding: utf-8 -*- + from Testing import ZopeTestCase as ztc +- +-from base import ContentFunctionalTestCase ++from plone.app.content.tests.base import ContentFunctionalTestCase +import doctest -+ -+from Testing import ZopeTestCase as ztc -+ -+from base import ContentFunctionalTestCase ++import unittest def test_suite(): return unittest.TestSuite(( ztc.ZopeDocFileSuite( -- 'basecontent.txt', -- package='plone.app.content', -+ 'basecontent.txt', package='plone.app.content', +- 'basecontent.txt', package='plone.app.content', ++ 'basecontent.txt', ++ package='plone.app.content', test_class=ContentFunctionalTestCase, -- optionflags=(doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)), -+ optionflags=(doctest.ELLIPSIS | -+ doctest.NORMALIZE_WHITESPACE)), +- optionflags=(doctest.ELLIPSIS | +- doctest.NORMALIZE_WHITESPACE)), ++ optionflags=(doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)), )) diff --git a/plone/app/content/tests/test_folder.py b/plone/app/content/tests/test_folder.py -index 4cab4bd..911af47 100644 +index 911af47..4cab4bd 100644 --- a/plone/app/content/tests/test_folder.py +++ b/plone/app/content/tests/test_folder.py -@@ -1,20 +1,23 @@ +@@ -1,23 +1,20 @@ # -*- coding: utf-8 -*- --from DateTime import DateTime --from Products.CMFCore.utils import getToolByName --from plone.app.content.testing import PLONE_APP_CONTENT_AT_INTEGRATION_TESTING --from plone.app.content.testing import PLONE_APP_CONTENT_DX_INTEGRATION_TESTING -+from plone.app.content.testing import ( -+ PLONE_APP_CONTENT_DX_INTEGRATION_TESTING, -+ PLONE_APP_CONTENT_AT_INTEGRATION_TESTING -+) +-from plone.app.content.testing import ( +- PLONE_APP_CONTENT_DX_INTEGRATION_TESTING, +- PLONE_APP_CONTENT_AT_INTEGRATION_TESTING +-) ++from DateTime import DateTime ++from Products.CMFCore.utils import getToolByName ++from plone.app.content.testing import PLONE_APP_CONTENT_AT_INTEGRATION_TESTING ++from plone.app.content.testing import PLONE_APP_CONTENT_DX_INTEGRATION_TESTING from plone.app.testing import TEST_USER_ID from plone.app.testing import TEST_USER_NAME from plone.app.testing import login from plone.app.testing import setRoles --from plone.dexterity.fti import DexterityFTI +- +-from zope.publisher.browser import TestRequest +-from plone.uuid.interfaces import IUUID +-import unittest -from plone.protect.authenticator import createToken -+ -+from zope.publisher.browser import TestRequest - from plone.uuid.interfaces import IUUID -+import unittest +-import json +-from DateTime import DateTime +-from Products.CMFCore.utils import getToolByName + from plone.dexterity.fti import DexterityFTI +from plone.protect.authenticator import createToken -+import json -+from DateTime import DateTime -+from Products.CMFCore.utils import getToolByName -+from plone.dexterity.fti import DexterityFTI ++from plone.uuid.interfaces import IUUID from zope.annotation.interfaces import IAttributeAnnotatable from zope.interface import alsoProvides --from zope.publisher.browser import TestRequest ++from zope.publisher.browser import TestRequest ++import json ++import unittest + + + class BaseTest(unittest.TestCase): +diff --git a/plone/app/content/tests/test_namechooser.py b/plone/app/content/tests/test_namechooser.py +index 4c40f62..70282a9 100644 +--- a/plone/app/content/tests/test_namechooser.py ++++ b/plone/app/content/tests/test_namechooser.py +@@ -1,6 +1,8 @@ +-from zope.component.testing import setUp, tearDown +-import unittest ++# -*- coding: utf-8 -*- ++from zope.component.testing import setUp ++from zope.component.testing import tearDown + import doctest ++import unittest + + + def test_suite(): +diff --git a/plone/app/content/tests/test_namechooser_unit.py b/plone/app/content/tests/test_namechooser_unit.py +index a874178..b65a256 100644 +--- a/plone/app/content/tests/test_namechooser_unit.py ++++ b/plone/app/content/tests/test_namechooser_unit.py +@@ -1,12 +1,13 @@ ++# -*- coding: utf-8 -*- + from Products.CMFCore.utils import getToolByName ++from plone.app.content.namechooser import ATTEMPTS + from plone.app.content.testing import PLONE_APP_CONTENT_INTEGRATION_TESTING + from plone.app.testing import TEST_USER_ID, TEST_USER_NAME +-from plone.app.testing import setRoles, login +-import transaction +-from plone.app.content.namechooser import ATTEMPTS ++from plone.app.testing import login ++from plone.app.testing import setRoles + from plone.dexterity.fti import DexterityFTI + from zope.container.interfaces import INameChooser +- ++import transaction + import unittest2 as unittest + + +diff --git a/plone/app/content/tests/test_reviewlist.py b/plone/app/content/tests/test_reviewlist.py +index 852fbc5..ec1666c 100644 +--- a/plone/app/content/tests/test_reviewlist.py ++++ b/plone/app/content/tests/test_reviewlist.py +@@ -1,8 +1,8 @@ ++# -*- coding: utf-8 -*- + from Products.CMFCore.utils import getToolByName +-import transaction +- + from plone.app.testing.bbb import PloneTestCase + from plone.testing.z2 import Browser ++import transaction + + + class ReviewListTestCase(PloneTestCase): +diff --git a/plone/app/content/tests/test_table.py b/plone/app/content/tests/test_table.py +index 804ce1f..3142590 100644 +--- a/plone/app/content/tests/test_table.py ++++ b/plone/app/content/tests/test_table.py +@@ -1,6 +1,8 @@ +-from zope.component.testing import setUp, tearDown +-import unittest ++# -*- coding: utf-8 -*- ++from zope.component.testing import setUp ++from zope.component.testing import tearDown + import doctest ++import unittest + + + def test_suite(): +diff --git a/plone/app/content/utils.py b/plone/app/content/utils.py +index adbbbbf..29ae09b 100644 +--- a/plone/app/content/utils.py ++++ b/plone/app/content/utils.py +@@ -1,6 +1,7 @@ -import json +-import datetime ++# -*- coding: utf-8 -*- + import Missing ++import datetime ++import json + + + def custom_json_handler(obj): +@@ -16,4 +17,4 @@ def json_dumps(data): + + + # can eventually provide custom handling here if we want +-json_loads = json.loads +\ No newline at end of file ++json_loads = json.loads +diff --git a/setup.py b/setup.py +index 2ba5379..ccc116b 100644 +--- a/setup.py ++++ b/setup.py +@@ -1,57 +1,60 @@ +-from setuptools import setup, find_packages ++# -*- coding: utf-8 -*- ++from setuptools import find_packages ++from setuptools import setup + + version = '3.0.3.dev0' + +-setup(name='plone.app.content', +- version=version, +- description="Content Views for Plone", +- long_description='\n\n'.join([ +- open("README.rst").read(), +- open("CHANGES.rst").read(), +- ]), +- classifiers=[ +- "Framework :: Plone", +- "Framework :: Plone :: 5.0", +- "License :: OSI Approved :: GNU General Public License (GPL)", +- "Programming Language :: Python", +- "Programming Language :: Python :: 2.7", +- ], +- keywords='plone content views viewlet', +- author='Plone Foundation', +- author_email='plone-developers@lists.sourceforge.net', +- url='http://pypi.python.org/pypi/plone.app.content', +- license='GPL version 2', +- packages=find_packages(exclude=['ez_setup']), +- namespace_packages=['plone', 'plone.app'], +- include_package_data=True, +- zip_safe=False, +- extras_require=dict( +- test=[ +- 'plone.app.testing', +- 'plone.app.contenttypes', +- ] +- ), +- install_requires=[ +- 'setuptools', +- 'plone.memoize', +- 'plone.batching', +- 'plone.i18n', +- 'zope.i18n', +- 'zope.i18nmessageid', +- 'zope.interface', +- 'zope.component', +- 'zope.container', +- 'zope.event', +- 'zope.lifecycleevent', +- 'zope.publisher', +- 'zope.schema', +- 'zope.viewlet', +- 'Acquisition', +- 'Products.CMFPlone', +- 'Products.CMFCore>=2.2.0dev', +- 'Products.CMFDefault', +- 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate +- 'Zope2', +- 'plone.app.widgets>=2.0.0.dev0' +- ], +- ) ++setup( ++ name='plone.app.content', ++ version=version, ++ description="Content Views for Plone", ++ long_description='\n\n'.join([ ++ open("README.rst").read(), ++ open("CHANGES.rst").read(), ++ ]), ++ classifiers=[ ++ "Framework :: Plone", ++ "Framework :: Plone :: 5.0", ++ "License :: OSI Approved :: GNU General Public License (GPL)", ++ "Programming Language :: Python", ++ "Programming Language :: Python :: 2.7", ++ ], ++ keywords='plone content views viewlet', ++ author='Plone Foundation', ++ author_email='plone-developers@lists.sourceforge.net', ++ url='http://pypi.python.org/pypi/plone.app.content', ++ license='GPL version 2', ++ packages=find_packages(exclude=['ez_setup']), ++ namespace_packages=['plone', 'plone.app'], ++ include_package_data=True, ++ zip_safe=False, ++ extras_require=dict( ++ test=[ ++ 'plone.app.testing', ++ 'plone.app.contenttypes', ++ ] ++ ), ++ install_requires=[ ++ 'Acquisition', ++ 'Products.CMFCore>=2.2.0dev', ++ 'Products.CMFDefault', ++ 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate ++ 'Products.CMFPlone', ++ 'Zope2', ++ 'plone.app.widgets>=2.0.0.dev0', ++ 'plone.batching', ++ 'plone.i18n', ++ 'plone.memoize', ++ 'setuptools', ++ 'zope.component', ++ 'zope.container', ++ 'zope.event', ++ 'zope.i18n', ++ 'zope.i18nmessageid', ++ 'zope.interface', ++ 'zope.lifecycleevent', ++ 'zope.publisher', ++ 'zope.schema', ++ 'zope.viewlet', ++ ], ++) + + +Repository: plone.app.content +Branch: refs/heads/master +Date: 2015-03-18T22:15:19+01:00 +Author: Gil Forcada (gforcada) +Commit: https://github.com/plone/plone.app.content/commit/d8e2203ba66007328c5365664004f7b1e523df7e + +Merge pull request #27 from plone/jensens-cleanup-2 + +Merge pull request #27 from plone/jensens-cleanup-2"" + +Files changed: +M CHANGES.rst +M plone/__init__.py +M plone/app/__init__.py +M plone/app/content/__init__.py +M plone/app/content/browser/__init__.py +M plone/app/content/browser/actions.py +M plone/app/content/browser/adding.py +M plone/app/content/browser/constraintypes.py +M plone/app/content/browser/content_status_history.py +M plone/app/content/browser/file.py +M plone/app/content/browser/folder.py +M plone/app/content/browser/folderfactories.py +M plone/app/content/browser/i18n.py +M plone/app/content/browser/interfaces.py +M plone/app/content/browser/query.py +M plone/app/content/browser/reviewlist.py +M plone/app/content/browser/selection.py +M plone/app/content/browser/tableview.py +M plone/app/content/browser/vocabulary.py +M plone/app/content/catalog.py +M plone/app/content/container.py +M plone/app/content/interfaces.py +M plone/app/content/item.py +M plone/app/content/namechooser.py +M plone/app/content/tests/test_adding.py +M plone/app/content/tests/test_basecontent.py +M plone/app/content/tests/test_folder.py +M plone/app/content/tests/test_namechooser.py +M plone/app/content/tests/test_namechooser_unit.py +M plone/app/content/tests/test_reviewlist.py +M plone/app/content/tests/test_table.py +M plone/app/content/utils.py +M setup.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 787db48..1a5c263 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -4,8 +4,12 @@ Changelog + 3.0.3 (unreleased) + ------------------ + +-- Nothing changed yet. ++- pep8, flake8, utf8-headers et al cleanup. ++ [jensens] + ++- refactored ``p.a.c.namechooser.NormalizingNameChooser._getCheckId`` to not ++ use lambdas. ++ [jensens] + + 3.0.2 (2015-03-13) + ------------------ +diff --git a/plone/__init__.py b/plone/__init__.py +index f48ad10..68c04af 100644 +--- a/plone/__init__.py ++++ b/plone/__init__.py +@@ -1,6 +1,2 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- ++__import__('pkg_resources').declare_namespace(__name__) +diff --git a/plone/app/__init__.py b/plone/app/__init__.py +index f48ad10..68c04af 100644 +--- a/plone/app/__init__.py ++++ b/plone/app/__init__.py +@@ -1,6 +1,2 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- ++__import__('pkg_resources').declare_namespace(__name__) +diff --git a/plone/app/content/__init__.py b/plone/app/content/__init__.py +index f48ad10..40a96af 100644 +--- a/plone/app/content/__init__.py ++++ b/plone/app/content/__init__.py +@@ -1,6 +1 @@ +-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +-try: +- __import__('pkg_resources').declare_namespace(__name__) +-except ImportError: +- from pkgutil import extend_path +- __path__ = extend_path(__path__, __name__) ++# -*- coding: utf-8 -*- +diff --git a/plone/app/content/browser/__init__.py b/plone/app/content/browser/__init__.py +index e69de29..40a96af 100644 +--- a/plone/app/content/browser/__init__.py ++++ b/plone/app/content/browser/__init__.py +@@ -0,0 +1 @@ ++# -*- coding: utf-8 -*- +diff --git a/plone/app/content/browser/actions.py b/plone/app/content/browser/actions.py +index c5dc0bc..3a3b63b 100644 +--- a/plone/app/content/browser/actions.py ++++ b/plone/app/content/browser/actions.py +@@ -9,11 +9,11 @@ + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile + from Products.statusmessages.interfaces import IStatusMessage + from ZODB.POSException import ConflictError +-from zExceptions import Unauthorized + from z3c.form import button + from z3c.form import field + from z3c.form import form + from z3c.form.widget import ComputedWidgetAttribute ++from zExceptions import Unauthorized + from zope import schema + from zope.component import getMultiAdapter + from zope.component import queryMultiAdapter +diff --git a/plone/app/content/browser/adding.py b/plone/app/content/browser/adding.py +index 725c1c5..26bed83 100644 +--- a/plone/app/content/browser/adding.py ++++ b/plone/app/content/browser/adding.py +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- + from Acquisition import Implicit + from Products.CMFCore.utils import getToolByName + from Products.Five.browser.adding import ContentAdding +diff --git a/plone/app/content/browser/constraintypes.py b/plone/app/content/browser/constraintypes.py +index 78db1ab..2869949 100644 +--- a/plone/app/content/browser/constraintypes.py ++++ b/plone/app/content/browser/constraintypes.py +@@ -1,32 +1,46 @@ +-from plone.autoform.form import AutoExtensibleForm ++# -*- coding: utf-8 -*- + from Products.CMFPlone import PloneMessageFactory as PC_ + from Products.CMFPlone.interfaces import ISelectableConstrainTypes + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile ++from plone.autoform.form import AutoExtensibleForm + from z3c.form import button + from z3c.form import form + from z3c.form.browser.checkbox import CheckBoxFieldWidget +-from zope.interface import implementer + from zope.interface import Interface ++from zope.interface import implementer + from zope.interface import invariant + from zope.interface.exceptions import Invalid +-from zope.schema import List, Choice ++from zope.schema import Choice ++from zope.schema import List + from zope.schema.interfaces import IVocabularyFactory +-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm ++from zope.schema.vocabulary import SimpleTerm ++from zope.schema.vocabulary import SimpleVocabulary + + # XXX +-ACQUIRE = -1 # acquire locallyAllowedTypes from parent (default) +-DISABLED = 0 # use default behavior of PortalFolder which uses the +- # FTI information +-ENABLED = 1 # allow types from locallyAllowedTypes only ++# acquire locallyAllowedTypes from parent (default) ++ACQUIRE = -1 ++ ++# use default behavior of PortalFolder which uses the FTI information ++DISABLED = 0 ++ ++# allow types from locallyAllowedTypes only ++ENABLED = 1 ++ + + ST = lambda key, txt, default: SimpleTerm(value=key, + title=PC_(txt, default=default)) +-possible_constrain_types = SimpleVocabulary( +- [ST(ACQUIRE, u'constraintypes_mode_acquire', +- u'Use parent folder settings'), +- ST(DISABLED, 'label_constraintypes_allow_standard', u'Use portal default'), +- ST(ENABLED, u'label_constraintypes_specify_manually', u'Select manually') +- ]) ++ ++possible_constrain_types = SimpleVocabulary([ ++ ST(ACQUIRE, ++ u'constraintypes_mode_acquire', ++ u'Use parent folder settings'), ++ ST(DISABLED, ++ 'label_constraintypes_allow_standard', ++ u'Use portal default'), ++ ST(ENABLED, ++ u'label_constraintypes_specify_manually', ++ u'Select manually') ++]) + + + @implementer(IVocabularyFactory) +diff --git a/plone/app/content/browser/content_status_history.py b/plone/app/content/browser/content_status_history.py +index 59d78d3..34a265a 100644 +--- a/plone/app/content/browser/content_status_history.py ++++ b/plone/app/content/browser/content_status_history.py +@@ -1,11 +1,13 @@ ++# -*- coding: utf-8 -*- + from Products.CMFCore.utils import getToolByName + from Products.CMFPlone import PloneMessageFactory as _ + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +-from zope.publisher.browser import BrowserView ++from z3c.form import field ++from z3c.form import form + from zope.interface import Interface ++from zope.publisher.browser import BrowserView + from zope.schema import Datetime + from zope.schema.fieldproperty import FieldProperty +-from z3c.form import form, field + + + class IContentStatusHistoryDates(Interface): +@@ -15,18 +17,22 @@ class IContentStatusHistoryDates(Interface): + effective_date = Datetime( + title=_(u"label_effective_date", + default=u"Publishing Date"), +- description=_(u"help_effective_date", +- default=u"The date when the item will be published. If no " +- u"date is selected the item will be published immediately."), ++ description=_( ++ u"help_effective_date", ++ default=u"The date when the item will be published. If no " ++ u"date is selected the item will be published immediately." ++ ), + required=False) + + expiration_date = Datetime( + title=_(u"label_expiration_date", + default=u"Expiration Date"), +- description=_(u"help_expiration_date", +- default=u"The date when the item expires. This will automatically " +- u"make the item invisible for others at the given date." +- u"If no date is chosen, it will never expire."), ++ description=_( ++ u"help_expiration_date", ++ default=u"The date when the item expires. This will automatically " ++ u"make the item invisible for others at the given date." ++ u"If no date is chosen, it will never expire." ++ ), + required=False) + + +@@ -35,8 +41,12 @@ class ContentStatusHistoryDatesForm(form.Form): + ignoreContext = True + label = "Content status history dates" + +- effective_date = FieldProperty(IContentStatusHistoryDates['effective_date']) +- expiration_date = FieldProperty(IContentStatusHistoryDates['expiration_date']) ++ effective_date = FieldProperty( ++ IContentStatusHistoryDates['effective_date'] ++ ) ++ expiration_date = FieldProperty( ++ IContentStatusHistoryDates['expiration_date'] ++ ) + + + class ContentStatusHistoryView(BrowserView): +@@ -56,11 +66,17 @@ def __call__(self, workflow_action=None, paths=[], comment="", + include_children=False, *args): + + data = self.dates_form.extractData() +- if self.request.get('form.widgets.effective_date-calendar', None) and data: +- effective_date = data[0]['effective_date'].strftime("%Y-%m-%d %H:%M") +- +- if self.request.get('form.widgets.expiration_date-calendar', None) and data: +- expiration_date = data[0]['expiration_date'].strftime("%Y-%m-%d %H:%M") ++ if self.request.get('form.widgets.effective_date-calendar', None) \ ++ and data: ++ effective_date = data[0]['effective_date'].strftime( ++ "%Y-%m-%d %H:%M" ++ ) ++ ++ if self.request.get('form.widgets.expiration_date-calendar', None) \ ++ and data: ++ expiration_date = data[0]['expiration_date'].strftime( ++ "%Y-%m-%d %H:%M" ++ ) + + if self.request.get('form.button.Cancel', None): + return self.request.RESPONSE.redirect( +diff --git a/plone/app/content/browser/file.py b/plone/app/content/browser/file.py +index 7598fd5..0d579c2 100644 +--- a/plone/app/content/browser/file.py ++++ b/plone/app/content/browser/file.py +@@ -1,13 +1,13 @@ ++# -*- coding: utf-8 -*- + from Products.CMFCore.utils import getToolByName + from Products.Five.browser import BrowserView +- +-import json +-import mimetypes +-from plone.dexterity.interfaces import IDexterityFTI + from plone.app.dexterity.interfaces import IDXFileFactory ++from plone.dexterity.interfaces import IDexterityFTI + from plone.uuid.interfaces import IUUID +-import os ++import json + import logging ++import mimetypes ++import os + + logger = logging.getLogger('plone') + +diff --git a/plone/app/content/browser/folder.py b/plone/app/content/browser/folder.py +index b621cba..d497bac 100644 +--- a/plone/app/content/browser/folder.py ++++ b/plone/app/content/browser/folder.py +@@ -1,4 +1,4 @@ +-from .interfaces import IFolderContentsView ++# -*- coding: utf-8 -*- + from AccessControl import Unauthorized + from AccessControl import getSecurityManager + from Acquisition import aq_inner +@@ -12,7 +12,9 @@ + from Products.CMFPlone.interfaces.siteroot import IPloneSiteRoot + from Products.Five import BrowserView + from ZODB.POSException import ConflictError +-from plone.app.content.utils import json_dumps, json_loads ++from plone.app.content.browser.interfaces import IFolderContentsView ++from plone.app.content.utils import json_dumps ++from plone.app.content.utils import json_loads + from plone.dexterity.interfaces import IDexterityContent + from plone.folder.interfaces import IExplicitOrdering + from plone.protect.postonly import check as checkpost +@@ -23,7 +25,7 @@ + from zope.component.hooks import getSite + from zope.container.interfaces import INameChooser + from zope.event import notify +-from zope.interface import implements ++from zope.interface import implementer + from zope.lifecycleevent import ObjectModifiedEvent + + import transaction +@@ -34,8 +36,8 @@ + TUS_ENABLED = False + + ++@implementer(IFolderContentsView) + class FolderContentsView(BrowserView): +- implements(IFolderContentsView) + + def __call__(self): + site = getSite() +diff --git a/plone/app/content/browser/folderfactories.py b/plone/app/content/browser/folderfactories.py +index 97ee853..088583b 100644 +--- a/plone/app/content/browser/folderfactories.py ++++ b/plone/app/content/browser/folderfactories.py +@@ -1,18 +1,18 @@ +-from urllib import quote_plus +- +-from plone.i18n.normalizer.interfaces import IIDNormalizer +-from plone.memoize.instance import memoize +-from plone.memoize.request import memoize_diy_request +-from zope.component import getMultiAdapter, queryUtility +-from zope.i18n import translate +-from zope.publisher.browser import BrowserView +- ++# -*- coding: utf-8 -*- + from Acquisition import aq_inner + from Acquisition import aq_parent + from Products.CMFCore.Expression import createExprContext + from Products.CMFCore.utils import getToolByName + from Products.CMFPlone.interfaces.constrains import ISelectableConstrainTypes + from plone.app.content.browser.interfaces import IFolderContentsView ++from plone.i18n.normalizer.interfaces import IIDNormalizer ++from plone.memoize.instance import memoize ++from plone.memoize.request import memoize_diy_request ++from urllib import quote_plus ++from zope.component import getMultiAdapter ++from zope.component import queryUtility ++from zope.i18n import translate ++from zope.publisher.browser import BrowserView + + + @memoize_diy_request(arg=0) +diff --git a/plone/app/content/browser/i18n.py b/plone/app/content/browser/i18n.py +index 612b510..8909b4e 100644 +--- a/plone/app/content/browser/i18n.py ++++ b/plone/app/content/browser/i18n.py +@@ -1,10 +1,9 @@ +-import json +- ++# -*- coding: utf-8 -*- ++from Products.Five.browser import BrowserView + from plone.memoize import ram + from zope.component import queryUtility + from zope.i18n.interfaces import ITranslationDomain +- +-from Products.Five.browser import BrowserView ++import json + + + def _cache_key(method, self, domain, language): +@@ -35,4 +34,4 @@ def __call__(self, domain, language=None): + response = self.request.response + response.setHeader('content-type', 'application/json') + response.setBody(json.dumps(catalog)) +- return response +\ No newline at end of file ++ return response +diff --git a/plone/app/content/browser/interfaces.py b/plone/app/content/browser/interfaces.py +index df1a648..3a558a6 100644 +--- a/plone/app/content/browser/interfaces.py ++++ b/plone/app/content/browser/interfaces.py +@@ -1,4 +1,4 @@ +-# Zope imports ++# -*- coding: utf-8 -*- + from zope.interface import Interface + from zope.viewlet.interfaces import IViewletManager + +diff --git a/plone/app/content/browser/query.py b/plone/app/content/browser/query.py +index 91dc9d1..9834029 100644 +--- a/plone/app/content/browser/query.py ++++ b/plone/app/content/browser/query.py +@@ -1,8 +1,9 @@ +-import json +-from plone.registry.interfaces import IRegistry ++# -*- coding: utf-8 -*- ++from Products.Five import BrowserView + from plone.app.querystring.interfaces import IQuerystringRegistryReader ++from plone.registry.interfaces import IRegistry + from zope.component import getUtility +-from Products.Five import BrowserView ++import json + + + class QueryStringIndexOptions(BrowserView): +diff --git a/plone/app/content/browser/reviewlist.py b/plone/app/content/browser/reviewlist.py +index eb17ec7..97104c3 100644 +--- a/plone/app/content/browser/reviewlist.py ++++ b/plone/app/content/browser/reviewlist.py +@@ -1,13 +1,13 @@ +-import urllib +- +-from zope.component import getMultiAdapter +-from zope.i18n import translate +-from zope.publisher.browser import BrowserView +- ++# -*- coding: utf-8 -*- + from Acquisition import aq_inner + from Products.CMFCore.utils import getToolByName + from Products.CMFPlone.utils import safe_unicode +-from plone.app.content.browser.tableview import Table, TableBrowserView ++from plone.app.content.browser.tableview import Table ++from plone.app.content.browser.tableview import TableBrowserView ++from zope.component import getMultiAdapter ++from zope.i18n import translate ++from zope.publisher.browser import BrowserView ++import urllib + + + class FullReviewListView(BrowserView): +diff --git a/plone/app/content/browser/selection.py b/plone/app/content/browser/selection.py +index bc083ee..99e8d47 100644 +--- a/plone/app/content/browser/selection.py ++++ b/plone/app/content/browser/selection.py +@@ -1,8 +1,9 @@ ++# -*- coding: utf-8 -*- + from Acquisition import aq_inner +-from Products.CMFPlone import PloneMessageFactory as _ +-from Products.statusmessages.interfaces import IStatusMessage + from Products.CMFCore.utils import getToolByName ++from Products.CMFPlone import PloneMessageFactory as _ + from Products.Five.browser import BrowserView ++from Products.statusmessages.interfaces import IStatusMessage + from zope.component import getMultiAdapter + + +diff --git a/plone/app/content/browser/tableview.py b/plone/app/content/browser/tableview.py +index 1b90f16..36b76ab 100644 +--- a/plone/app/content/browser/tableview.py ++++ b/plone/app/content/browser/tableview.py +@@ -1,22 +1,16 @@ +-import urllib +- +-from plone.memoize import instance +- ++# -*- coding: utf-8 -*- ++from Products.CMFPlone.utils import safe_unicode + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +- ++from ZTUtils import make_query + from plone.batching import Batch +- ++from plone.batching.browser import BatchView ++from plone.memoize import instance + from zope.i18nmessageid import MessageFactory +- +-from Products.CMFPlone.utils import safe_unicode ++from zope.publisher.browser import BrowserView ++import urllib + + _ = MessageFactory('plone') + +-from ZTUtils import make_query +- +-from plone.batching.browser import BatchView +-from zope.publisher.browser import BrowserView +- + + class TableBatchView(BatchView): + +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index 6bc2bde..3caeba5 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -1,11 +1,11 @@ + # -*- coding: utf-8 -*- +- + from AccessControl import getSecurityManager + from Products.CMFCore.utils import getToolByName + from Products.CMFPlone.interfaces import IPloneSiteRoot + from Products.Five import BrowserView + from logging import getLogger +-from plone.app.content.utils import json_loads, json_dumps ++from plone.app.content.utils import json_dumps ++from plone.app.content.utils import json_loads + from plone.app.querystring import queryparser + from plone.app.widgets.interfaces import IFieldPermissionChecker + from plone.autoform.interfaces import WRITE_PERMISSIONS_KEY +diff --git a/plone/app/content/catalog.py b/plone/app/content/catalog.py +index 5ae53f1..632448c 100644 +--- a/plone/app/content/catalog.py ++++ b/plone/app/content/catalog.py +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- + + + def reindexOnModify(content, event): +diff --git a/plone/app/content/container.py b/plone/app/content/container.py +index 0783f2b..1f083b0 100644 +--- a/plone/app/content/container.py ++++ b/plone/app/content/container.py +@@ -1,23 +1,21 @@ +-from zope.container.interfaces import IContainer +-from zope.container.contained import Contained +-from zope.interface import implements +- ++# -*- coding: utf-8 -*- ++from Products.CMFCore.CMFCatalogAware import CMFCatalogAware + from Products.CMFCore.PortalContent import PortalContent + from Products.CMFCore.PortalFolder import PortalFolderBase +-from Products.CMFCore.CMFCatalogAware import CMFCatalogAware + from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl +- + from plone.app.content.interfaces import IReindexOnModify ++from zope.container.contained import Contained ++from zope.container.interfaces import IContainer ++from zope.interface import implementer + + ++@implementer(IContainer) + class OFSContainer(object): + """A folder that's also a container. + + Borrowed in part from megrok.five. + """ + +- implements(IContainer) +- + isPrincipiaFolderish = 1 + + def __init__(self, id=None): +@@ -69,14 +67,14 @@ def __len__(self): + # + # ... I WANT AN ADAPTER! + ++ ++@implementer(IReindexOnModify) + class Container(OFSContainer, CMFCatalogAware, PortalFolderBase, PortalContent, + DefaultDublinCoreImpl, Contained): + """A base class mixing in CMFish, contentish, containerish, containedish, + dublincoreish behaviour. + """ + +- implements(IReindexOnModify) +- + def __init__(self, id=None, **kwargs): + OFSContainer.__init__(self, id, **kwargs) + PortalFolderBase.__init__(self, id, **kwargs) +diff --git a/plone/app/content/interfaces.py b/plone/app/content/interfaces.py +index b08d66f..b51e45a 100644 +--- a/plone/app/content/interfaces.py ++++ b/plone/app/content/interfaces.py +@@ -1,36 +1,20 @@ +-from zope.interface import Interface ++# -*- coding: utf-8 -*- + from zope import schema ++from zope.interface import Interface + + + class INameFromTitle(Interface): + """An object that supports gettings it name from its title. + """ + +- title = schema.TextLine(title=u"Title", +- description=u"A title, which will be converted to " +- u"a name", +- required=True) ++ title = schema.TextLine( ++ title=u"Title", ++ description=u"A title, which will be converted to a name", ++ required=True ++ ) + + + class IReindexOnModify(Interface): + """Marker interface which makes sure an object gets reindexed when + it's modified. + """ +- +-# XXX: This should be deprecated and removed in Plone 4. +- +-class IIndexableObjectWrapper(Interface): +- """An adapter of a (object, portal) where object is to be indexed in +- portal_catalog. +- +- This should implement __getattr__(), which in turn should react +- when the catalog tries to get attributes to index. +- +- The update() method must be called before the catalog is given the +- wrapper. +- """ +- +- def update(vars, **kwargs): +- """Update the wrapper with variables from e.g. the workflow +- tool. +- """ +diff --git a/plone/app/content/item.py b/plone/app/content/item.py +index 7a7478b..46b95f8 100644 +--- a/plone/app/content/item.py ++++ b/plone/app/content/item.py +@@ -1,18 +1,16 @@ +-from zope.container.contained import Contained +-from zope.interface import implements +- ++# -*- coding: utf-8 -*- + from Products.CMFCore.PortalContent import PortalContent + from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl +- + from plone.app.content.interfaces import IReindexOnModify ++from zope.container.contained import Contained ++from zope.interface import implementer + + ++@implementer(IReindexOnModify) + class Item(PortalContent, DefaultDublinCoreImpl, Contained): + """A non-containerish, CMFish item + """ + +- implements(IReindexOnModify) +- + def __init__(self, id=None, **kwargs): + DefaultDublinCoreImpl.__init__(self, **kwargs) + if id is not None: +diff --git a/plone/app/content/namechooser.py b/plone/app/content/namechooser.py +index b5fd297..51ba0f5 100644 +--- a/plone/app/content/namechooser.py ++++ b/plone/app/content/namechooser.py +@@ -1,19 +1,20 @@ ++# -*- coding: utf-8 -*- ++from Acquisition import aq_base ++from Acquisition import aq_inner ++from plone.app.content.interfaces import INameFromTitle + from plone.i18n.normalizer import FILENAME_REGEX +-from plone.i18n.normalizer.interfaces import IUserPreferredURLNormalizer + from plone.i18n.normalizer.interfaces import IURLNormalizer ++from plone.i18n.normalizer.interfaces import IUserPreferredURLNormalizer ++from zExceptions import BadRequest + from zope.component import getUtility + from zope.container.interfaces import INameChooser +-from zope.interface import implements +- +-from Acquisition import aq_inner, aq_base +-from zExceptions import BadRequest +- +-from plone.app.content.interfaces import INameFromTitle ++from zope.interface import implementer + import time + + ATTEMPTS = 100 + + ++@implementer(INameChooser) + class NormalizingNameChooser(object): + """A name chooser for a Zope object manager. + +@@ -21,8 +22,6 @@ class NormalizingNameChooser(object): + title to generate a name. + """ + +- implements(INameChooser) +- + def __init__(self, context): + self.context = context + +@@ -93,15 +92,18 @@ def _getCheckId(self, obj): + """ + parent = aq_inner(self.context) + _check_id = getattr(obj, 'check_id', None) +- if _check_id is not None: +- def do_Plone_check(id, required): +- return _check_id(id, required=required, contained_by=parent) +- check_id = lambda id, required: do_Plone_check(id, required) +- else: +- def do_OFS_check(parent, id): +- try: +- parent._checkId(id) +- except BadRequest: +- return True +- check_id = lambda id, required: do_OFS_check(parent, id) +- return check_id ++ ++ def do_Plone_check(newid, required): ++ if _check_id is not None: ++ return _check_id( ++ newid, ++ required=required, ++ contained_by=parent ++ ) ++ # fallback to OFS ++ try: ++ parent._checkId(newid) ++ except BadRequest: ++ return True ++ ++ return do_Plone_check +diff --git a/plone/app/content/tests/test_adding.py b/plone/app/content/tests/test_adding.py +index 97131f7..3df20b0 100644 +--- a/plone/app/content/tests/test_adding.py ++++ b/plone/app/content/tests/test_adding.py +@@ -1,3 +1,4 @@ ++# -*- coding: utf-8 -*- + from Acquisition import aq_get + from plone.app.testing.bbb import PloneTestCase + +diff --git a/plone/app/content/tests/test_basecontent.py b/plone/app/content/tests/test_basecontent.py +index 7a8f678..c8ac5ab 100644 +--- a/plone/app/content/tests/test_basecontent.py ++++ b/plone/app/content/tests/test_basecontent.py +@@ -1,16 +1,15 @@ +-import unittest +-import doctest +- ++# -*- coding: utf-8 -*- + from Testing import ZopeTestCase as ztc +- +-from base import ContentFunctionalTestCase ++from plone.app.content.tests.base import ContentFunctionalTestCase ++import doctest ++import unittest + + + def test_suite(): + return unittest.TestSuite(( + ztc.ZopeDocFileSuite( +- 'basecontent.txt', package='plone.app.content', ++ 'basecontent.txt', ++ package='plone.app.content', + test_class=ContentFunctionalTestCase, +- optionflags=(doctest.ELLIPSIS | +- doctest.NORMALIZE_WHITESPACE)), ++ optionflags=(doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)), + )) +diff --git a/plone/app/content/tests/test_folder.py b/plone/app/content/tests/test_folder.py +index 911af47..4cab4bd 100644 +--- a/plone/app/content/tests/test_folder.py ++++ b/plone/app/content/tests/test_folder.py +@@ -1,23 +1,20 @@ + # -*- coding: utf-8 -*- +-from plone.app.content.testing import ( +- PLONE_APP_CONTENT_DX_INTEGRATION_TESTING, +- PLONE_APP_CONTENT_AT_INTEGRATION_TESTING +-) ++from DateTime import DateTime ++from Products.CMFCore.utils import getToolByName ++from plone.app.content.testing import PLONE_APP_CONTENT_AT_INTEGRATION_TESTING ++from plone.app.content.testing import PLONE_APP_CONTENT_DX_INTEGRATION_TESTING + from plone.app.testing import TEST_USER_ID + from plone.app.testing import TEST_USER_NAME + from plone.app.testing import login + from plone.app.testing import setRoles +- +-from zope.publisher.browser import TestRequest +-from plone.uuid.interfaces import IUUID -import unittest +-from plone.protect.authenticator import createToken +-import json +-from DateTime import DateTime +-from Products.CMFCore.utils import getToolByName + from plone.dexterity.fti import DexterityFTI ++from plone.protect.authenticator import createToken ++from plone.uuid.interfaces import IUUID + from zope.annotation.interfaces import IAttributeAnnotatable + from zope.interface import alsoProvides ++from zope.publisher.browser import TestRequest ++import json ++import unittest class BaseTest(unittest.TestCase): diff --git a/plone/app/content/tests/test_namechooser.py b/plone/app/content/tests/test_namechooser.py -index 70282a9..4c40f62 100644 +index 4c40f62..70282a9 100644 --- a/plone/app/content/tests/test_namechooser.py +++ b/plone/app/content/tests/test_namechooser.py -@@ -1,8 +1,6 @@ --# -*- coding: utf-8 -*- --from zope.component.testing import setUp --from zope.component.testing import tearDown --import doctest -+from zope.component.testing import setUp, tearDown - import unittest -+import doctest +@@ -1,6 +1,8 @@ +-from zope.component.testing import setUp, tearDown +-import unittest ++# -*- coding: utf-8 -*- ++from zope.component.testing import setUp ++from zope.component.testing import tearDown + import doctest ++import unittest def test_suite(): diff --git a/plone/app/content/tests/test_namechooser_unit.py b/plone/app/content/tests/test_namechooser_unit.py -index b65a256..a874178 100644 +index a874178..b65a256 100644 --- a/plone/app/content/tests/test_namechooser_unit.py +++ b/plone/app/content/tests/test_namechooser_unit.py -@@ -1,13 +1,12 @@ --# -*- coding: utf-8 -*- +@@ -1,12 +1,13 @@ ++# -*- coding: utf-8 -*- from Products.CMFCore.utils import getToolByName --from plone.app.content.namechooser import ATTEMPTS ++from plone.app.content.namechooser import ATTEMPTS from plone.app.content.testing import PLONE_APP_CONTENT_INTEGRATION_TESTING from plone.app.testing import TEST_USER_ID, TEST_USER_NAME --from plone.app.testing import login --from plone.app.testing import setRoles -+from plone.app.testing import setRoles, login -+import transaction -+from plone.app.content.namechooser import ATTEMPTS +-from plone.app.testing import setRoles, login +-import transaction +-from plone.app.content.namechooser import ATTEMPTS ++from plone.app.testing import login ++from plone.app.testing import setRoles from plone.dexterity.fti import DexterityFTI from zope.container.interfaces import INameChooser --import transaction -+ +- ++import transaction import unittest2 as unittest diff --git a/plone/app/content/tests/test_reviewlist.py b/plone/app/content/tests/test_reviewlist.py -index ec1666c..852fbc5 100644 +index 852fbc5..ec1666c 100644 --- a/plone/app/content/tests/test_reviewlist.py +++ b/plone/app/content/tests/test_reviewlist.py @@ -1,8 +1,8 @@ --# -*- coding: utf-8 -*- ++# -*- coding: utf-8 -*- from Products.CMFCore.utils import getToolByName -+import transaction -+ +-import transaction +- from plone.app.testing.bbb import PloneTestCase from plone.testing.z2 import Browser --import transaction ++import transaction class ReviewListTestCase(PloneTestCase): diff --git a/plone/app/content/tests/test_table.py b/plone/app/content/tests/test_table.py -index 3142590..804ce1f 100644 +index 804ce1f..3142590 100644 --- a/plone/app/content/tests/test_table.py +++ b/plone/app/content/tests/test_table.py -@@ -1,8 +1,6 @@ --# -*- coding: utf-8 -*- --from zope.component.testing import setUp --from zope.component.testing import tearDown --import doctest -+from zope.component.testing import setUp, tearDown - import unittest -+import doctest +@@ -1,6 +1,8 @@ +-from zope.component.testing import setUp, tearDown +-import unittest ++# -*- coding: utf-8 -*- ++from zope.component.testing import setUp ++from zope.component.testing import tearDown + import doctest ++import unittest def test_suite(): diff --git a/plone/app/content/utils.py b/plone/app/content/utils.py -index 29ae09b..adbbbbf 100644 +index adbbbbf..29ae09b 100644 --- a/plone/app/content/utils.py +++ b/plone/app/content/utils.py -@@ -1,7 +1,6 @@ --# -*- coding: utf-8 -*- --import Missing +@@ -1,6 +1,7 @@ +-import json -import datetime - import json ++# -*- coding: utf-8 -*- + import Missing +import datetime -+import Missing ++import json def custom_json_handler(obj): -@@ -17,4 +16,4 @@ def json_dumps(data): +@@ -16,4 +17,4 @@ def json_dumps(data): # can eventually provide custom handling here if we want -json_loads = json.loads -+json_loads = json.loads \ No newline at end of file ++json_loads = json.loads diff --git a/setup.py b/setup.py -index 6edf0d1..2ba5379 100644 +index 2ba5379..ccc116b 100644 --- a/setup.py +++ b/setup.py -@@ -1,60 +1,57 @@ --# -*- coding: utf-8 -*- --from setuptools import find_packages --from setuptools import setup -+from setuptools import setup, find_packages +@@ -1,57 +1,60 @@ +-from setuptools import setup, find_packages ++# -*- coding: utf-8 -*- ++from setuptools import find_packages ++from setuptools import setup version = '3.0.3.dev0' --setup( -- name='plone.app.content', -- version=version, -- description="Content Views for Plone", -- long_description='\n\n'.join([ -- open("README.rst").read(), -- open("CHANGES.rst").read(), -- ]), -- classifiers=[ -- "Framework :: Plone", -- "Framework :: Plone :: 5.0", -- "License :: OSI Approved :: GNU General Public License (GPL)", -- "Programming Language :: Python", -- "Programming Language :: Python :: 2.7", -- ], -- keywords='plone content views viewlet', -- author='Plone Foundation', -- author_email='plone-developers@lists.sourceforge.net', -- url='http://pypi.python.org/pypi/plone.app.content', -- license='GPL version 2', -- packages=find_packages(exclude=['ez_setup']), -- namespace_packages=['plone', 'plone.app'], -- include_package_data=True, -- zip_safe=False, -- extras_require=dict( -- test=[ -- 'plone.app.testing', -- 'plone.app.contenttypes', -- ] -- ), -- install_requires=[ -- 'Acquisition', -- 'Products.CMFCore>=2.2.0dev', -- 'Products.CMFDefault', -- 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate -- 'Products.CMFPlone', -- 'Zope2', -- 'plone.app.widgets>=2.0.0.dev0' -- 'plone.batching', -- 'plone.i18n', -- 'plone.memoize', -- 'setuptools', -- 'zope.component', -- 'zope.container', -- 'zope.event', -- 'zope.i18n', -- 'zope.i18nmessageid', -- 'zope.interface', -- 'zope.lifecycleevent', -- 'zope.publisher', -- 'zope.schema', -- 'zope.viewlet', -- ], --) -+setup(name='plone.app.content', -+ version=version, -+ description="Content Views for Plone", -+ long_description='\n\n'.join([ -+ open("README.rst").read(), -+ open("CHANGES.rst").read(), -+ ]), -+ classifiers=[ -+ "Framework :: Plone", -+ "Framework :: Plone :: 5.0", -+ "License :: OSI Approved :: GNU General Public License (GPL)", -+ "Programming Language :: Python", -+ "Programming Language :: Python :: 2.7", -+ ], -+ keywords='plone content views viewlet', -+ author='Plone Foundation', -+ author_email='plone-developers@lists.sourceforge.net', -+ url='http://pypi.python.org/pypi/plone.app.content', -+ license='GPL version 2', -+ packages=find_packages(exclude=['ez_setup']), -+ namespace_packages=['plone', 'plone.app'], -+ include_package_data=True, -+ zip_safe=False, -+ extras_require=dict( -+ test=[ -+ 'plone.app.testing', -+ 'plone.app.contenttypes', -+ ] -+ ), -+ install_requires=[ -+ 'setuptools', -+ 'plone.memoize', -+ 'plone.batching', -+ 'plone.i18n', -+ 'zope.i18n', -+ 'zope.i18nmessageid', -+ 'zope.interface', -+ 'zope.component', -+ 'zope.container', -+ 'zope.event', -+ 'zope.lifecycleevent', -+ 'zope.publisher', -+ 'zope.schema', -+ 'zope.viewlet', -+ 'Acquisition', -+ 'Products.CMFPlone', -+ 'Products.CMFCore>=2.2.0dev', -+ 'Products.CMFDefault', -+ 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate -+ 'Zope2', -+ 'plone.app.widgets>=2.0.0.dev0' -+ ], -+ ) +-setup(name='plone.app.content', +- version=version, +- description="Content Views for Plone", +- long_description='\n\n'.join([ +- open("README.rst").read(), +- open("CHANGES.rst").read(), +- ]), +- classifiers=[ +- "Framework :: Plone", +- "Framework :: Plone :: 5.0", +- "License :: OSI Approved :: GNU General Public License (GPL)", +- "Programming Language :: Python", +- "Programming Language :: Python :: 2.7", +- ], +- keywords='plone content views viewlet', +- author='Plone Foundation', +- author_email='plone-developers@lists.sourceforge.net', +- url='http://pypi.python.org/pypi/plone.app.content', +- license='GPL version 2', +- packages=find_packages(exclude=['ez_setup']), +- namespace_packages=['plone', 'plone.app'], +- include_package_data=True, +- zip_safe=False, +- extras_require=dict( +- test=[ +- 'plone.app.testing', +- 'plone.app.contenttypes', +- ] +- ), +- install_requires=[ +- 'setuptools', +- 'plone.memoize', +- 'plone.batching', +- 'plone.i18n', +- 'zope.i18n', +- 'zope.i18nmessageid', +- 'zope.interface', +- 'zope.component', +- 'zope.container', +- 'zope.event', +- 'zope.lifecycleevent', +- 'zope.publisher', +- 'zope.schema', +- 'zope.viewlet', +- 'Acquisition', +- 'Products.CMFPlone', +- 'Products.CMFCore>=2.2.0dev', +- 'Products.CMFDefault', +- 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate +- 'Zope2', +- 'plone.app.widgets>=2.0.0.dev0' +- ], +- ) ++setup( ++ name='plone.app.content', ++ version=version, ++ description="Content Views for Plone", ++ long_description='\n\n'.join([ ++ open("README.rst").read(), ++ open("CHANGES.rst").read(), ++ ]), ++ classifiers=[ ++ "Framework :: Plone", ++ "Framework :: Plone :: 5.0", ++ "License :: OSI Approved :: GNU General Public License (GPL)", ++ "Programming Language :: Python", ++ "Programming Language :: Python :: 2.7", ++ ], ++ keywords='plone content views viewlet', ++ author='Plone Foundation', ++ author_email='plone-developers@lists.sourceforge.net', ++ url='http://pypi.python.org/pypi/plone.app.content', ++ license='GPL version 2', ++ packages=find_packages(exclude=['ez_setup']), ++ namespace_packages=['plone', 'plone.app'], ++ include_package_data=True, ++ zip_safe=False, ++ extras_require=dict( ++ test=[ ++ 'plone.app.testing', ++ 'plone.app.contenttypes', ++ ] ++ ), ++ install_requires=[ ++ 'Acquisition', ++ 'Products.CMFCore>=2.2.0dev', ++ 'Products.CMFDefault', ++ 'Products.CMFDynamicViewFTI', # required for cmf.ModifyViewTemplate ++ 'Products.CMFPlone', ++ 'Zope2', ++ 'plone.app.widgets>=2.0.0.dev0', ++ 'plone.batching', ++ 'plone.i18n', ++ 'plone.memoize', ++ 'setuptools', ++ 'zope.component', ++ 'zope.container', ++ 'zope.event', ++ 'zope.i18n', ++ 'zope.i18nmessageid', ++ 'zope.interface', ++ 'zope.lifecycleevent', ++ 'zope.publisher', ++ 'zope.schema', ++ 'zope.viewlet', ++ ], ++)