diff --git a/CHANGES.rst b/CHANGES.rst index eec609c..0f9dfb5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,7 +14,8 @@ New features: Bug fixes: -- *add item here* +- More Python 2 / 3 compatibility. + [pbauer] 3.0.5 (2018-02-04) diff --git a/plone/app/discussion/browser/comment.py b/plone/app/discussion/browser/comment.py index ab5f32d..6497fec 100644 --- a/plone/app/discussion/browser/comment.py +++ b/plone/app/discussion/browser/comment.py @@ -2,7 +2,7 @@ from AccessControl import getSecurityManager from Acquisition import aq_inner from Acquisition import aq_parent -from comments import CommentForm +from .comments import CommentForm from plone.app.discussion import _ from plone.registry.interfaces import IRegistry from plone.z3cform.layout import wrap_form diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index c817517..2689c97 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -19,7 +19,7 @@ from plone.z3cform.interfaces import IWrappedForm from Products.CMFCore.utils import getToolByName from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from Products.statusmessages.interfaces import IStatusMessage -from urllib import quote as url_quote +from six.moves.urllib.parse import quote from z3c.form import button from z3c.form import field from z3c.form import form @@ -537,7 +537,7 @@ class CommentsViewlet(ViewletBase): def login_action(self): return '{0}/login_form?came_from={1}'.format( self.navigation_root_url, - url_quote(self.request.get('URL', '')), + quote(self.request.get('URL', '')), ) def format_time(self, time): diff --git a/plone/app/discussion/catalog.py b/plone/app/discussion/catalog.py index 1ada61b..97c5dc7 100644 --- a/plone/app/discussion/catalog.py +++ b/plone/app/discussion/catalog.py @@ -12,7 +12,6 @@ from plone.uuid.interfaces import IUUID from Products.CMFCore.interfaces import IContentish from Products.CMFPlone.utils import safe_unicode from Products.ZCatalog.interfaces import IZCatalog -from string import join MAX_DESCRIPTION = 25 @@ -77,7 +76,7 @@ def creator(object): @indexer(IComment) def description(object): # Return the first 25 words of the comment text and append ' [...]' - text = join(object.getText(targetMimetype='text/plain').split()[:MAX_DESCRIPTION]) + text = ' '.join(object.getText(targetMimetype='text/plain').split()[:MAX_DESCRIPTION]) if len(object.getText().split()) > 25: text += ' [...]' return text diff --git a/plone/app/discussion/tests/test_comments_viewlet.py b/plone/app/discussion/tests/test_comments_viewlet.py index 630b237..6f2ff23 100644 --- a/plone/app/discussion/tests/test_comments_viewlet.py +++ b/plone/app/discussion/tests/test_comments_viewlet.py @@ -727,7 +727,7 @@ class TestCommentsViewlet(unittest.TestCase): ) def test_format_time(self): - python_time = datetime(2009, 02, 01, 23, 32, 03, 57) + python_time = datetime(2009, 2, 1, 23, 32, 3, 57) # Python Time must be utc time. There seems to be no too simple way # to tell datetime to be of utc time. # therefor, we convert the time to seconds since epoch, which seems diff --git a/plone/app/discussion/tool.py b/plone/app/discussion/tool.py index 902e6a6..a10ae3c 100644 --- a/plone/app/discussion/tool.py +++ b/plone/app/discussion/tool.py @@ -5,8 +5,8 @@ standard portal_catalog for indexing comments. BBB support for the old portal_discussion is provided in the bbb package. """ -from interfaces import IComment -from interfaces import ICommentingTool +from .interfaces import IComment +from .interfaces import ICommentingTool from OFS.SimpleItem import SimpleItem from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import UniqueObject