Remove ImportError exceptions for Plone < 4.1 code and plone.z3cform < 0.6.0.
svn path=/plone.app.discussion/trunk/; revision=49033
This commit is contained in:
parent
31ecf38129
commit
b84211ddf0
@ -41,12 +41,8 @@ from plone.z3cform import z2
|
|||||||
from plone.z3cform.widget import SingleCheckBoxWidget
|
from plone.z3cform.widget import SingleCheckBoxWidget
|
||||||
from plone.z3cform.fieldsets import extensible
|
from plone.z3cform.fieldsets import extensible
|
||||||
|
|
||||||
# starting from 0.6.0 version plone.z3cform has IWrappedForm interface
|
|
||||||
try:
|
|
||||||
from plone.z3cform.interfaces import IWrappedForm
|
from plone.z3cform.interfaces import IWrappedForm
|
||||||
HAS_WRAPPED_FORM = True
|
|
||||||
except ImportError: # pragma: no cover
|
|
||||||
HAS_WRAPPED_FORM = False
|
|
||||||
|
|
||||||
COMMENT_DESCRIPTION_PLAIN_TEXT = _(
|
COMMENT_DESCRIPTION_PLAIN_TEXT = _(
|
||||||
u"comment_description_plain_text",
|
u"comment_description_plain_text",
|
||||||
@ -265,7 +261,6 @@ class CommentsViewlet(ViewletBase):
|
|||||||
super(CommentsViewlet, self).update()
|
super(CommentsViewlet, self).update()
|
||||||
z2.switch_on(self, request_layer=IFormLayer)
|
z2.switch_on(self, request_layer=IFormLayer)
|
||||||
self.form = self.form(aq_inner(self.context), self.request)
|
self.form = self.form(aq_inner(self.context), self.request)
|
||||||
if HAS_WRAPPED_FORM:
|
|
||||||
alsoProvides(self.form, IWrappedForm)
|
alsoProvides(self.form, IWrappedForm)
|
||||||
self.form.update()
|
self.form.update()
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@ from plone.app.discussion.interfaces import IConversation, IComment
|
|||||||
|
|
||||||
from plone.indexer import indexer
|
from plone.indexer import indexer
|
||||||
|
|
||||||
try:
|
|
||||||
from plone.uuid.interfaces import IUUID
|
from plone.uuid.interfaces import IUUID
|
||||||
except ImportError:
|
|
||||||
IUUID = None
|
|
||||||
|
|
||||||
MAX_DESCRIPTION = 25
|
MAX_DESCRIPTION = 25
|
||||||
|
|
||||||
|
@ -40,11 +40,7 @@ from plone.app.discussion.interfaces import IDiscussionSettings
|
|||||||
from Products.CMFCore.CMFCatalogAware import CatalogAware
|
from Products.CMFCore.CMFCatalogAware import CatalogAware
|
||||||
from Products.CMFCore.CMFCatalogAware import WorkflowAware
|
from Products.CMFCore.CMFCatalogAware import WorkflowAware
|
||||||
|
|
||||||
try:
|
|
||||||
from OFS.role import RoleManager
|
from OFS.role import RoleManager
|
||||||
except ImportError:
|
|
||||||
# Zope <=2.12
|
|
||||||
from AccessControl.Role import RoleManager
|
|
||||||
|
|
||||||
|
|
||||||
COMMENT_TITLE = _(u"comment_title",
|
COMMENT_TITLE = _(u"comment_title",
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
"""
|
"""
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
try:
|
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
@ -13,10 +12,7 @@ try:
|
|||||||
|
|
||||||
from plone.app.discussion.testing import \
|
from plone.app.discussion.testing import \
|
||||||
PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING
|
PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING
|
||||||
PLONE4 = True
|
|
||||||
except ImportError:
|
|
||||||
import unittest
|
|
||||||
PLONE4 = False
|
|
||||||
|
|
||||||
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE)
|
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE)
|
||||||
normal_testfiles = [
|
normal_testfiles = [
|
||||||
@ -24,8 +20,6 @@ normal_testfiles = [
|
|||||||
'functional_test_comment_review_workflow.txt'
|
'functional_test_comment_review_workflow.txt'
|
||||||
]
|
]
|
||||||
|
|
||||||
if PLONE4:
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
suite.addTests([
|
suite.addTests([
|
||||||
@ -38,10 +32,3 @@ if PLONE4:
|
|||||||
for test in normal_testfiles])
|
for test in normal_testfiles])
|
||||||
return suite
|
return suite
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
def test_suite():
|
|
||||||
return unittest.TestSuite([])
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main(defaultTest='test_suite')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user