remove six plus some bbb cleanup

This commit is contained in:
Jens W. Klein 2022-05-01 23:27:37 +02:00
parent 75c6a5dcc1
commit 19571f45ed
7 changed files with 28 additions and 64 deletions

View File

@ -19,7 +19,7 @@ from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode from Products.CMFPlone.utils import safe_unicode
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 six.moves.urllib.parse import quote from 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

View File

@ -12,8 +12,6 @@ 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
import six
MAX_DESCRIPTION = 25 MAX_DESCRIPTION = 25
@ -75,8 +73,6 @@ def creator(object):
if not object.creator: if not object.creator:
return return
value = safe_unicode(object.creator) value = safe_unicode(object.creator)
if six.PY2:
return value.encode("utf8")
return value return value

View File

@ -39,7 +39,6 @@ from zope.i18nmessageid import Message
from zope.interface import implementer from zope.interface import implementer
import logging import logging
import six
COMMENT_TITLE = _( COMMENT_TITLE = _(
@ -161,8 +160,6 @@ class Comment(
text = self.text text = self.text
if text is None: if text is None:
return "" return ""
if six.PY2 and isinstance(text, str):
text = text.encode("utf8")
transform = transforms.convertTo( transform = transforms.convertTo(
targetMimetype, text, context=self, mimetype=sourceMimetype targetMimetype, text, context=self, mimetype=sourceMimetype
) )

View File

@ -36,7 +36,6 @@ from zope.lifecycleevent import ObjectAddedEvent
from zope.lifecycleevent import ObjectCreatedEvent from zope.lifecycleevent import ObjectCreatedEvent
from zope.lifecycleevent import ObjectRemovedEvent from zope.lifecycleevent import ObjectRemovedEvent
import six
import time import time

View File

@ -2,9 +2,7 @@ from plone.app.discussion.browser.comment import View
from plone.app.discussion.interfaces import IComment from plone.app.discussion.interfaces import IComment
from plone.app.discussion.interfaces import IConversation from plone.app.discussion.interfaces import IConversation
from plone.app.discussion.interfaces import IReplies from plone.app.discussion.interfaces import IReplies
from plone.app.discussion.testing import ( # noqa from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
PLONE_APP_DISCUSSION_INTEGRATION_TESTING,
)
from plone.app.testing import setRoles from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID from plone.app.testing import TEST_USER_ID
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
@ -13,7 +11,6 @@ from zope.component import getMultiAdapter
import datetime import datetime
import logging import logging
import six
import unittest import unittest

View File

@ -7,12 +7,11 @@ from plone.app.discussion.interfaces import IComment
from plone.app.discussion.interfaces import IConversation from plone.app.discussion.interfaces import IConversation
from plone.app.discussion.interfaces import IDiscussionSettings from plone.app.discussion.interfaces import IDiscussionSettings
from plone.app.discussion.interfaces import IReplies from plone.app.discussion.interfaces import IReplies
from plone.app.discussion.testing import ( # noqa from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
PLONE_APP_DISCUSSION_INTEGRATION_TESTING,
)
from plone.app.testing import setRoles from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID from plone.app.testing import TEST_USER_ID
from plone.app.vocabularies.types import BAD_TYPES from plone.app.vocabularies.types import BAD_TYPES
from plone.dexterity.interfaces import IDexterityContent
from plone.registry.interfaces import IRegistry from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zope import interface from zope import interface
@ -20,18 +19,9 @@ from zope.annotation.interfaces import IAnnotations
from zope.component import createObject from zope.component import createObject
from zope.component import queryUtility from zope.component import queryUtility
import six
import unittest import unittest
try:
from plone.dexterity.interfaces import IDexterityContent
DEXTERITY = True
except ImportError:
DEXTERITY = False
class ConversationTest(unittest.TestCase): class ConversationTest(unittest.TestCase):
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
@ -688,11 +678,10 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
interfaces.IDiscussionLayer, interfaces.IDiscussionLayer,
) )
if DEXTERITY: interface.alsoProvides(
interface.alsoProvides( self.portal.doc1,
self.portal.doc1, IDexterityContent,
IDexterityContent, )
)
def _makeOne(self, *args, **kw): def _makeOne(self, *args, **kw):
return self.portal.doc1.restrictedTraverse("@@conversation_view") return self.portal.doc1.restrictedTraverse("@@conversation_view")
@ -708,38 +697,33 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
document_fti.manage_changeProperties(allow_discussion=allow_discussion) document_fti.manage_changeProperties(allow_discussion=allow_discussion)
def test_conversation_is_not_enabled_by_default(self): def test_conversation_is_not_enabled_by_default(self):
if DEXTERITY: conversation = self._makeOne(self.portal.doc1)
conversation = self._makeOne(self.portal.doc1) self.assertFalse(conversation.enabled())
self.assertFalse(conversation.enabled())
def test_conversation_is_not_enabled_by_default_on_portal_type(self): def test_conversation_is_not_enabled_by_default_on_portal_type(self):
if DEXTERITY: self._globally_enable_discussion(True)
self._globally_enable_discussion(True) conversation = self._makeOne(self.portal.doc1)
conversation = self._makeOne(self.portal.doc1) self.assertFalse(conversation.enabled())
self.assertFalse(conversation.enabled())
def test_conversation_needs_to_be_enabled_globally_and_for_type(self): def test_conversation_needs_to_be_enabled_globally_and_for_type(self):
if DEXTERITY: self._globally_enable_discussion(True)
self._globally_enable_discussion(True) self._enable_discussion_on_portal_type("Document", True)
self._enable_discussion_on_portal_type("Document", True) conversation = self._makeOne(self.portal.doc1)
conversation = self._makeOne(self.portal.doc1) self.assertTrue(conversation.enabled())
self.assertTrue(conversation.enabled())
def test_disable_discussion(self): def test_disable_discussion(self):
if DEXTERITY: self._globally_enable_discussion(True)
self._globally_enable_discussion(True) self._enable_discussion_on_portal_type("Document", True)
self._enable_discussion_on_portal_type("Document", True) self.portal.doc1.allow_discussion = False
self.portal.doc1.allow_discussion = False conversation = self._makeOne(self.portal.doc1)
conversation = self._makeOne(self.portal.doc1) self.assertFalse(conversation.enabled())
self.assertFalse(conversation.enabled())
def test_enable_discussion(self): def test_enable_discussion(self):
if DEXTERITY: self._globally_enable_discussion(True)
self._globally_enable_discussion(True) self._enable_discussion_on_portal_type("Document", True)
self._enable_discussion_on_portal_type("Document", True) self.portal.doc1.allow_discussion = True
self.portal.doc1.allow_discussion = True conversation = self._makeOne(self.portal.doc1)
conversation = self._makeOne(self.portal.doc1) self.assertTrue(conversation.enabled())
self.assertTrue(conversation.enabled())
class RepliesTest(unittest.TestCase): class RepliesTest(unittest.TestCase):

View File

@ -10,18 +10,9 @@ install_requires = [
"plone.app.registry", "plone.app.registry",
"plone.app.uuid", "plone.app.uuid",
"plone.app.z3cform", "plone.app.z3cform",
"plone.base",
"plone.indexer", "plone.indexer",
"plone.registry",
"plone.z3cform", "plone.z3cform",
"six",
"ZODB3",
"zope.interface",
"zope.component",
"zope.annotation",
"zope.event",
"zope.container",
"zope.lifecycleevent",
"zope.site",
"z3c.form>=2.3.3", "z3c.form>=2.3.3",
] ]