diff --git a/news/371.bugfix b/news/371.bugfix new file mode 100644 index 00000000..5f63bea4 --- /dev/null +++ b/news/371.bugfix @@ -0,0 +1,3 @@ +`plone.app.discussion` is now a core addon. +The `plone.discussion` behavior class was moved over there. +[@jensens] diff --git a/plone/app/dexterity/behaviors/configure.zcml b/plone/app/dexterity/behaviors/configure.zcml index aee0d089..e5c09ccb 100644 --- a/plone/app/dexterity/behaviors/configure.zcml +++ b/plone/app/dexterity/behaviors/configure.zcml @@ -113,14 +113,6 @@ provides=".nextprevious.INextPreviousToggle" /> - - - >> portal = layer['portal'] - >>> from plone.dexterity.fti import DexterityFTI - >>> fti = DexterityFTI('discussiondocument') - >>> fti.behaviors = ('plone.app.dexterity.behaviors.discussion.IAllowDiscussion',) - >>> portal.portal_types._setObject('discussiondocument', fti) - 'discussiondocument' - -Set up a test browser:: - - >>> from plone.app.testing import TEST_USER_ID, TEST_USER_NAME, TEST_USER_PASSWORD, setRoles - >>> setRoles(portal, TEST_USER_ID, ['Manager']) - >>> import transaction; transaction.commit() - >>> from plone.testing.zope import Browser - >>> browser = Browser(layer['app']) - >>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD,)) - -We have to make sure the request provides IDiscussonLayer because the enabled -method on the conversation calls conversation_view (which is only registered -for IDiscussionLayer). - - >>> from plone.app.discussion.interfaces import IDiscussionLayer - >>> from zope.interface import alsoProvides - >>> alsoProvides(portal.REQUEST, IDiscussionLayer) - -Add a document:: - - >>> browser.open('http://nohost/plone/++add++discussiondocument') - - -Default Allow Discussion Options --------------------------------- - -There are three options for the allow discussion select field:: - - >>> allowDiscussion = browser.getControl('Allow discussion') - >>> allowDiscussion.options - ['--NOVALUE--', 'True', 'False'] - -By default, no value is set for allow discussion:: - - >>> browser.getControl('Allow discussion').value - ['--NOVALUE--'] - >>> browser.getControl('Save').click() - >>> browser.url - 'http://nohost/plone/discussiondocument/view' - -This means discussion is not enabled: - - >>> from plone.app.discussion.interfaces import IConversation - >>> conv = IConversation(portal.discussiondocument) - >>> conv.enabled() - False - -We have to globally enable discussion in order to be able to add comments:: - - >>> from plone.registry.interfaces import IRegistry - >>> from zope.component import queryUtility - >>> from plone.app.discussion.interfaces import IDiscussionSettings - >>> registry = queryUtility(IRegistry) - >>> settings = registry.forInterface(IDiscussionSettings) - >>> settings.globally_enabled = True - -Discussion is still disabled for our content object though:: - - >>> from plone.app.discussion.interfaces import IConversation - >>> conv = IConversation(portal.discussiondocument) - >>> conv.enabled() - False - -This is because discussion is disabled by default for the document content -type:: - - >>> fti.allow_discussion - False - -If we allow discussion for the 'Document' content type, the conversation -for our content object is enabled because it just uses the default setting -(because allow_discussion is set to None):: - - >>> fti.allow_discussion = True - >>> from plone.app.discussion.interfaces import IConversation - >>> conv = IConversation(portal.discussiondocument) - >>> conv.enabled() - True - -We can now override the default value (True) by explicitly setting allow discussion to False:: - - >>> browser.open('http://nohost/plone/discussiondocument/edit') - >>> allowDiscussion = browser.getControl('Allow discussion') - >>> allowDiscussion.value = ['False'] - >>> browser.getControl('Save').click() - -Discussion on our content object is now not enabled:: - - >>> from plone.app.discussion.interfaces import IConversation - >>> conv = IConversation(portal.discussiondocument) - >>> conv.enabled() - False diff --git a/plone/app/dexterity/tests/test_doctests.py b/plone/app/dexterity/tests/test_doctests.py index 6b361554..a84ddd14 100644 --- a/plone/app/dexterity/tests/test_doctests.py +++ b/plone/app/dexterity/tests/test_doctests.py @@ -6,7 +6,6 @@ tests = ( - "discussion.txt", "editing.rst", "metadata.txt", "nextprevious.txt", diff --git a/setup.py b/setup.py index 87a884a4..a490eaf0 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,6 @@ "test": [ "plone.app.robotframework", "plone.app.testing", - "plone.app.discussion", "plone.i18n", "plone.testing", "robotsuite",