some py3 fixes
This commit is contained in:
parent
ae71eab164
commit
71dcbf8465
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user