Merge pull request #130 from plone/python3

Python3
This commit is contained in:
Jens W. Klein 2018-04-12 08:14:11 +02:00 committed by GitHub
commit ac1ac4ae4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -14,7 +14,8 @@ New features:
Bug fixes: Bug fixes:
- *add item here* - More Python 2 / 3 compatibility.
[pbauer]
3.0.5 (2018-02-04) 3.0.5 (2018-02-04)

View File

@ -2,7 +2,7 @@
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Acquisition import aq_inner from Acquisition import aq_inner
from Acquisition import aq_parent from Acquisition import aq_parent
from comments import CommentForm from .comments import CommentForm
from plone.app.discussion import _ from plone.app.discussion import _
from plone.registry.interfaces import IRegistry from plone.registry.interfaces import IRegistry
from plone.z3cform.layout import wrap_form from plone.z3cform.layout import wrap_form

View File

@ -19,7 +19,7 @@ from plone.z3cform.interfaces import IWrappedForm
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.statusmessages.interfaces import IStatusMessage 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 button
from z3c.form import field from z3c.form import field
from z3c.form import form from z3c.form import form
@ -537,7 +537,7 @@ class CommentsViewlet(ViewletBase):
def login_action(self): def login_action(self):
return '{0}/login_form?came_from={1}'.format( return '{0}/login_form?came_from={1}'.format(
self.navigation_root_url, self.navigation_root_url,
url_quote(self.request.get('URL', '')), quote(self.request.get('URL', '')),
) )
def format_time(self, time): def format_time(self, time):

View File

@ -12,7 +12,6 @@ from plone.uuid.interfaces import IUUID
from Products.CMFCore.interfaces import IContentish from Products.CMFCore.interfaces import IContentish
from Products.CMFPlone.utils import safe_unicode from Products.CMFPlone.utils import safe_unicode
from Products.ZCatalog.interfaces import IZCatalog from Products.ZCatalog.interfaces import IZCatalog
from string import join
MAX_DESCRIPTION = 25 MAX_DESCRIPTION = 25
@ -77,7 +76,7 @@ def creator(object):
@indexer(IComment) @indexer(IComment)
def description(object): def description(object):
# Return the first 25 words of the comment text and append ' [...]' # 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: if len(object.getText().split()) > 25:
text += ' [...]' text += ' [...]'
return text return text

View File

@ -727,7 +727,7 @@ class TestCommentsViewlet(unittest.TestCase):
) )
def test_format_time(self): 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 # Python Time must be utc time. There seems to be no too simple way
# to tell datetime to be of utc time. # to tell datetime to be of utc time.
# therefor, we convert the time to seconds since epoch, which seems # therefor, we convert the time to seconds since epoch, which seems

View File

@ -5,8 +5,8 @@ standard portal_catalog for indexing comments.
BBB support for the old portal_discussion is provided in the bbb package. BBB support for the old portal_discussion is provided in the bbb package.
""" """
from interfaces import IComment from .interfaces import IComment
from interfaces import ICommentingTool from .interfaces import ICommentingTool
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import UniqueObject from Products.CMFCore.utils import UniqueObject