From 9790dd5b65bfff1fe31ca2c819fee35ed30ffe25 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 20 Jan 2011 19:49:58 +0000 Subject: [PATCH 01/26] Enable discussion by default if p.a.discussion is shipped as add-on product. svn path=/plone.app.discussion/branches/1.x/; revision=46973 --- CHANGES.txt | 3 --- plone/app/discussion/interfaces.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cd15295..3a7ce71 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,9 +22,6 @@ Changelog - Avoid sending multiple notification emails to the same person when he has commented multiple times. [maurits] - -- Disable discussion by default. - [timo] - Move discussion action item from actionicons.xml to actions.xml to avoid deprecation warning. diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index bfdf1a7..1259c0c 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -29,7 +29,7 @@ class IDiscussionSettings(Interface): "specific content types, folders or content objects " "before users will be able to post comments."), required=False, - default=False, + default=True, ) anonymous_comments = schema.Bool( From f3ff8e9647845f1b219059759cafaadcbd879a96 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 20 Jan 2011 20:08:51 +0000 Subject: [PATCH 02/26] Fix failing test. Discussion is enabled by default again. svn path=/plone.app.discussion/branches/1.x/; revision=46975 --- plone/app/discussion/tests/test_controlpanel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/discussion/tests/test_controlpanel.py b/plone/app/discussion/tests/test_controlpanel.py index 3be32c0..85271c7 100644 --- a/plone/app/discussion/tests/test_controlpanel.py +++ b/plone/app/discussion/tests/test_controlpanel.py @@ -46,7 +46,7 @@ class RegistryTest(PloneTestCase): self.assertEquals( self.registry['plone.app.discussion.interfaces.' + 'IDiscussionSettings.globally_enabled'], - False) + True) def test_anonymous_comments(self): # Check anonymous_comments record From 57d4dbd32fc0964f19857676e8a840f1b2405e31 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 21 Jan 2011 08:09:53 +0000 Subject: [PATCH 03/26] plone 3.3.x hudson conf added. svn path=/plone.app.discussion/branches/1.x/; revision=46979 --- hudson-plone-3.3.x.cfg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 hudson-plone-3.3.x.cfg diff --git a/hudson-plone-3.3.x.cfg b/hudson-plone-3.3.x.cfg new file mode 100644 index 0000000..153b1a3 --- /dev/null +++ b/hudson-plone-3.3.x.cfg @@ -0,0 +1,13 @@ +[buildout] +extends = + test-plone-3.3.x.cfg + http://svn.plone.org/svn/collective/buildout/hudson/hudson.cfg + +package-name = plone.app.discussion +package-directories = . + +jstestdriver-directories = + plone/app/discussion + +browsers = + /usr/bin/firefox \ No newline at end of file From 5cac8b7a1b9d65546afd02cd49aa905d3ff796eb Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sat, 22 Jan 2011 12:00:15 +0000 Subject: [PATCH 04/26] Hide the moderation_enabled widget in the discussion control panel. We need plone.app.controlpanel > 2.1b1 for this, which is not shipped with Plone 3.x or 4.0.x. svn path=/plone.app.discussion/branches/1.x/; revision=46989 --- CHANGES.txt | 2 +- plone/app/discussion/browser/controlpanel.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3a7ce71..3d01bc4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ Changelog ========= -1.0RC1 (unreleased) +1.0RC1 (2011-01-22) ------------------- - Always show existing comments, even if commenting is disabled. diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py index cb790f8..41c47a4 100644 --- a/plone/app/discussion/browser/controlpanel.py +++ b/plone/app/discussion/browser/controlpanel.py @@ -19,7 +19,7 @@ from zope.app.component.hooks import getSite from zope.component import getMultiAdapter, queryUtility -from z3c.form import button +from z3c.form import button, interfaces from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget from plone.app.discussion.interfaces import IDiscussionSettings, _ @@ -66,6 +66,14 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): self.widgets['user_notification_enabled'].label = \ _(u"User Email Notification") + # Hide the moderation_enabled widget. We need plone.app.controlpanel + # > 2.1b1 in order to make sure that the proper events are fired when + # the workflow for discussion items is changed in the types control + # panel. Though, Plone 3 and 4.0 ship with an older version of + # p.a.controlpanel that do not fire this event properly. + # http://dev.plone.org/plone/changeset/46270/plone.app.controlpanel/trunk + self.widgets['moderation_enabled'].mode = interfaces.HIDDEN_MODE + @button.buttonAndHandler(_('Save'), name='save') def handleSave(self, action): data, errors = self.extractData() From 2f30c27555ce5eeb360f3c75cbe53033560ceb8e Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sat, 22 Jan 2011 12:34:49 +0000 Subject: [PATCH 05/26] Disable the control panel event subscribers. We don't need them since we disabled the enable_moderation setting in the discussion control panel anyway. svn path=/plone.app.discussion/branches/1.x/; revision=46990 --- plone/app/discussion/subscribers.zcml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plone/app/discussion/subscribers.zcml b/plone/app/discussion/subscribers.zcml index 73207ae..e6fcd99 100644 --- a/plone/app/discussion/subscribers.zcml +++ b/plone/app/discussion/subscribers.zcml @@ -40,7 +40,12 @@ /> - + + From ed4f2b1fa8527b5483df0c71e062057ec682e7d2 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sat, 22 Jan 2011 12:39:15 +0000 Subject: [PATCH 06/26] Comment out the discussion control panel event subscriber tests. We disabled this functionality anyway. svn path=/plone.app.discussion/branches/1.x/; revision=46991 --- .../app/discussion/tests/test_controlpanel.py | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/plone/app/discussion/tests/test_controlpanel.py b/plone/app/discussion/tests/test_controlpanel.py index 85271c7..39b029d 100644 --- a/plone/app/discussion/tests/test_controlpanel.py +++ b/plone/app/discussion/tests/test_controlpanel.py @@ -99,71 +99,71 @@ class RegistryTest(PloneTestCase): # 'IDiscussionSettings.user_notification_enabled'], False) -class ConfigurationChangedSubscriberTest(PloneTestCase): - - layer = DiscussionLayer - - def afterSetUp(self): - self.loginAsPortalOwner() - # Set up the registry - registry = queryUtility(IRegistry) - self.settings = registry.forInterface(IDiscussionSettings, check=False) - - def test_moderation_enabled_in_discussion_control_panel_changed(self): - """Make sure the 'Discussion Item' workflow is changed properly, when - the 'comment_moderation' setting in the discussion control panel - changes. - """ - # By default the one_state_workflow without moderation is enabled - self.assertEquals(('one_state_workflow',), - self.portal.portal_workflow.getChainForPortalType( - 'Discussion Item')) - - # Enable moderation in the discussion control panel - self.settings.moderation_enabled = True - - # Make sure the comment_review_workflow with moderation enabled is - # enabled - self.assertEquals(('comment_review_workflow',), - self.portal.portal_workflow.getChainForPortalType( - 'Discussion Item')) - # And back - self.settings.moderation_enabled = False - self.assertEquals(('one_state_workflow',), - self.portal.portal_workflow.getChainForPortalType( - 'Discussion Item')) - - def test_change_workflow_in_types_control_panel(self): - """Make sure the setting in the discussion control panel is changed - accordingly, when the workflow for the 'Discussion Item' changed in - the types control panel. - """ - # By default, moderation is disabled - self.settings.moderation_enabled = False - - # Enable the 'comment_review_workflow' with moderation enabled - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('comment_review_workflow',)) - - # Make sure the moderation_enabled settings has changed - self.settings.moderation_enabled = True - - # Enable the 'comment_review_workflow' with moderation enabled - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('one_state_workflow',)) - self.settings.moderation_enabled = True - - # Enable a 'custom' discussion workflow - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('intranet_workflow',)) - - # Setting has not changed. A Custom workflow disables the - # enable_moderation checkbox in the discussion control panel. The - # setting itself remains unchanged. - self.settings.moderation_enabled = True +#class ConfigurationChangedSubscriberTest(PloneTestCase): +# +# layer = DiscussionLayer +# +# def afterSetUp(self): +# self.loginAsPortalOwner() +# # Set up the registry +# registry = queryUtility(IRegistry) +# self.settings = registry.forInterface(IDiscussionSettings, check=False) +# +# def test_moderation_enabled_in_discussion_control_panel_changed(self): +# """Make sure the 'Discussion Item' workflow is changed properly, when +# the 'comment_moderation' setting in the discussion control panel +# changes. +# """ +# # By default the one_state_workflow without moderation is enabled +# self.assertEquals(('one_state_workflow',), +# self.portal.portal_workflow.getChainForPortalType( +# 'Discussion Item')) +# +# # Enable moderation in the discussion control panel +# self.settings.moderation_enabled = True +# +# # Make sure the comment_review_workflow with moderation enabled is +# # enabled +# self.assertEquals(('comment_review_workflow',), +# self.portal.portal_workflow.getChainForPortalType( +# 'Discussion Item')) +# # And back +# self.settings.moderation_enabled = False +# self.assertEquals(('one_state_workflow',), +# self.portal.portal_workflow.getChainForPortalType( +# 'Discussion Item')) +# +# def test_change_workflow_in_types_control_panel(self): +# """Make sure the setting in the discussion control panel is changed +# accordingly, when the workflow for the 'Discussion Item' changed in +# the types control panel. +# """ +# # By default, moderation is disabled +# self.settings.moderation_enabled = False +# +# # Enable the 'comment_review_workflow' with moderation enabled +# self.portal.portal_workflow.setChainForPortalTypes( +# ('Discussion Item',), +# ('comment_review_workflow',)) +# +# # Make sure the moderation_enabled settings has changed +# self.settings.moderation_enabled = True +# +# # Enable the 'comment_review_workflow' with moderation enabled +# self.portal.portal_workflow.setChainForPortalTypes( +# ('Discussion Item',), +# ('one_state_workflow',)) +# self.settings.moderation_enabled = True +# +# # Enable a 'custom' discussion workflow +# self.portal.portal_workflow.setChainForPortalTypes( +# ('Discussion Item',), +# ('intranet_workflow',)) +# +# # Setting has not changed. A Custom workflow disables the +# # enable_moderation checkbox in the discussion control panel. The +# # setting itself remains unchanged. +# self.settings.moderation_enabled = True def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) From 9c9abb9b6f6b3660d7065a5d9ff252bcc00462c4 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sat, 22 Jan 2011 12:54:14 +0000 Subject: [PATCH 07/26] Fix typo in version string; Fix good-py link in readme. svn path=/plone.app.discussion/branches/1.x/; revision=46993 --- README.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index b794c30..a90c5aa 100644 --- a/README.txt +++ b/README.txt @@ -29,7 +29,7 @@ To install plone.app.discussion, add the following code to your buildout.cfg:: ... extends = ... - http://good-py.appspot.com/release/plone.app.discussion/1.0b12 + http://good-py.appspot.com/release/plone.app.discussion/1.0 ... diff --git a/setup.py b/setup.py index 43c5255..84eabde 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import sys from setuptools import setup, find_packages -version = '1.0bRC1' +version = '1.0RC1' install_requires = [ 'setuptools', From f44cb442ebdf9dd7dbd634677313f1ab677195e3 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sat, 22 Jan 2011 12:54:54 +0000 Subject: [PATCH 08/26] Prepare plone.app.discussion 1.0RC1. svn path=/plone.app.discussion/branches/1.x/; revision=46994 --- versions.plone4.cfg | 46 ++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/versions.plone4.cfg b/versions.plone4.cfg index 990f4d8..0184fbf 100644 --- a/versions.plone4.cfg +++ b/versions.plone4.cfg @@ -1,25 +1,25 @@ [versions] -Products.PDBDebugMode = 1.1 +Products.PDBDebugMode = 1.3 Products.PrintingMailHost = 0.7 Sphinx-PyPI-upload = 0.2.1 collective.recipe.omelette = 0.10 collective.recipe.template = 1.8 -collective.xmltestreport = 1.0b3 -collective.z3cform.datetimewidget = 1.0.2 +collective.xmltestreport = 1.1 +collective.z3cform.datetimewidget = 1.0.4 coverage = 3.4 hexagonit.recipe.download = 1.4.1 -interlude = 1.0 +interlude = 1.1.1 ipython = 0.10.1 -jarn.mkrelease = 3.0.8 +jarn.mkrelease = 3.0.9 logilab.pylintinstaller = 0.15.2 mr.developer = 1.16 -plone.app.testing = 1.0a2 -plone.autoform = 1.0b4 -plone.supermodel = 1.0b5 -plone.testing = 1.0a2 +plone.app.testing = 4.0a4 +plone.autoform = 1.0b5 +plone.supermodel = 1.0b6 +plone.testing = 4.0a4 recaptcha-client = 1.0.5 -repoze.sphinx.autointerface = 0.4 -zptlint = 0.2.3 +repoze.sphinx.autointerface = 0.5 +zptlint = 0.2.4 #Required by: #collective.akismet 1.0b2dev @@ -31,14 +31,22 @@ collective.autopermission = 1.0b1 #Required by: #plone.app.discussion 1.0bRC1 -plone.registry = 1.0b2 +plone.app.uuid = 1.0b2 #Required by: -#jarn.mkrelease 3.0.8 +#plone.app.discussion 1.0bRC1 +plone.registry = 1.0b3 + +#Required by: +#plone.app.uuid 1.0b2 +plone.uuid = 1.0b2 + +#Required by: +#jarn.mkrelease 3.0.9 setuptools-git = 0.3.4 #Required by: -#jarn.mkrelease 3.0.8 +#jarn.mkrelease 3.0.9 setuptools-hg = 0.2 #Required by: @@ -46,13 +54,17 @@ setuptools-hg = 0.2 skimpyGimpy = 1.4 #Required by: -#plone.testing 1.0a2 +#plone.testing 4.0a4 unittest2 = 0.5.1 #Required by: -#plone.z3cform 0.7.1dev +#plone.z3cform 0.7.2dev z3c.batching = 1.1.0 #Required by: -#plone.app.z3cform 0.5.1 +#plone.app.z3cform 0.5.3 z3c.formwidget.query = 0.5 + +#Required by: +#collective.xmltestreport 1.1 +zope.testrunner = 4.0.0 From 543b9d47c5724b6cb7bb8990de365f7ba5b25ad3 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 24 Jan 2011 08:37:43 +0000 Subject: [PATCH 09/26] Remove moderation_enabled setting from registry to avoid migration problems to 1.0RC1. Refs #11419. svn path=/plone.app.discussion/branches/1.x/; revision=47031 --- CHANGES.txt | 8 +++++ plone/app/discussion/browser/controlpanel.py | 20 +++++-------- plone/app/discussion/interfaces.py | 29 ++++++++++--------- .../app/discussion/tests/test_controlpanel.py | 15 +++++----- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3d01bc4..75bb182 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,14 @@ Changelog ========= +1.0RC2 (2011-01-24) +------------------- + +- Remove moderation_enabled setting from registry to avoid migration problems + to 1.0RC1. This fixes http://dev.plone.org/plone/ticket/11419. + [timo] + + 1.0RC1 (2011-01-22) ------------------- diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py index 41c47a4..86fec5e 100644 --- a/plone/app/discussion/browser/controlpanel.py +++ b/plone/app/discussion/browser/controlpanel.py @@ -45,8 +45,9 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): super(DiscussionSettingsEditForm, self).updateFields() self.fields['globally_enabled'].widgetFactory = \ SingleCheckBoxFieldWidget - self.fields['moderation_enabled'].widgetFactory = \ - SingleCheckBoxFieldWidget + # p.a.discussion > 2.0 only + #self.fields['moderation_enabled'].widgetFactory = \ + # SingleCheckBoxFieldWidget self.fields['anonymous_comments'].widgetFactory = \ SingleCheckBoxFieldWidget self.fields['show_commenter_image'].widgetFactory = \ @@ -65,14 +66,8 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): _(u"Moderator Email Notification") self.widgets['user_notification_enabled'].label = \ _(u"User Email Notification") - - # Hide the moderation_enabled widget. We need plone.app.controlpanel - # > 2.1b1 in order to make sure that the proper events are fired when - # the workflow for discussion items is changed in the types control - # panel. Though, Plone 3 and 4.0 ship with an older version of - # p.a.controlpanel that do not fire this event properly. - # http://dev.plone.org/plone/changeset/46270/plone.app.controlpanel/trunk - self.widgets['moderation_enabled'].mode = interfaces.HIDDEN_MODE + # p.a.discussion > 2.0 only + #self.widgets['moderation_enabled'].mode = interfaces.HIDDEN_MODE @button.buttonAndHandler(_('Save'), name='save') def handleSave(self, action): @@ -117,8 +112,9 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): if 'one_state_workflow' not in wf and \ 'comment_review_workflow' not in wf: output.append("moderation_custom") - elif settings.moderation_enabled: - output.append("moderation_enabled") + # p.a.discussion > 2.0 only + #elif settings.moderation_enabled: + # output.append("moderation_enabled") # Anonymous comments if settings.anonymous_comments: diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index 1259c0c..adb57e4 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -44,20 +44,21 @@ class IDiscussionSettings(Interface): default=False, ) - moderation_enabled = schema.Bool( - title=_(u"label_moderation_enabled", - default="Enable comment moderation"), - description=_(u"help_moderation_enabled", - default=u"If selected, comments will enter a 'Pending' state " - "in which they are invisible to the public. A user " - "with the 'Review comments' permission ('Reviewer' or " - "'Manager') can approve comments to make them visible " - "to the public. If you want to enable a custom " - "comment workflow, you have to go to the types " - "control panel."), - required=False, - default=False, - ) +# p.a.discussion > 2.0 only +# moderation_enabled = schema.Bool( +# title=_(u"label_moderation_enabled", +# default="Enable comment moderation"), +# description=_(u"help_moderation_enabled", +# default=u"If selected, comments will enter a 'Pending' state " +# "in which they are invisible to the public. A user " +# "with the 'Review comments' permission ('Reviewer' or " +# "'Manager') can approve comments to make them visible " +# "to the public. If you want to enable a custom " +# "comment workflow, you have to go to the types " +# "control panel."), +# required=False, +# default=False, +# ) text_transform = schema.Choice( diff --git a/plone/app/discussion/tests/test_controlpanel.py b/plone/app/discussion/tests/test_controlpanel.py index 39b029d..f3f925b 100644 --- a/plone/app/discussion/tests/test_controlpanel.py +++ b/plone/app/discussion/tests/test_controlpanel.py @@ -54,13 +54,14 @@ class RegistryTest(PloneTestCase): self.assertEquals(self.registry['plone.app.discussion.interfaces.' + 'IDiscussionSettings.anonymous_comments'], False) - def test_moderation_enabled(self): - # Check globally_enabled record - self.failUnless('moderation_enabled' in IDiscussionSettings) - self.assertEquals( - self.registry['plone.app.discussion.interfaces.' + - 'IDiscussionSettings.moderation_enabled'], - False) +# p.a.discussion > 2.0 only +# def test_moderation_enabled(self): +# # Check globally_enabled record +# self.failUnless('moderation_enabled' in IDiscussionSettings) +# self.assertEquals( +# self.registry['plone.app.discussion.interfaces.' + +# 'IDiscussionSettings.moderation_enabled'], +# False) def test_text_transform(self): self.failUnless('text_transform' in IDiscussionSettings) From e8971a364add7e5a6d43e66d3ea8787ba0868151 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 24 Jan 2011 08:38:14 +0000 Subject: [PATCH 10/26] Set version to 1.0RC2. svn path=/plone.app.discussion/branches/1.x/; revision=47032 --- docs/source/conf.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c60c355..2276b12 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -53,7 +53,7 @@ copyright = u'2010, Timo Stollenwerk - Plone Foundation' # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. -release = '1.0RC1' +release = '1.0RC2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 84eabde..1c8979a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import sys from setuptools import setup, find_packages -version = '1.0RC1' +version = '1.0RC2' install_requires = [ 'setuptools', From 65a4371d4d19b00f256d536a1b5dc1a940de8eaf Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 24 Jan 2011 09:49:02 +0000 Subject: [PATCH 11/26] Clean up Plone 4 test buildout. svn path=/plone.app.discussion/branches/1.x/; revision=47033 --- test-plone-4.0.x.cfg | 161 ++----------------------------------------- 1 file changed, 4 insertions(+), 157 deletions(-) diff --git a/test-plone-4.0.x.cfg b/test-plone-4.0.x.cfg index aa15b30..efa14f0 100644 --- a/test-plone-4.0.x.cfg +++ b/test-plone-4.0.x.cfg @@ -8,175 +8,22 @@ package-directory = plone/app/discussion parts += omelette test - pycoverage - coverage - coverage-plain - coverage-xml - coverage-html - jstestdriver-build - jstestdriver-build-coverage - jstestdriver - pylint - pylint-test - zptlint - zptlint-test + [versions] -zope.schema = 3.6.0 +zope.schema = 3.6.4 Sphinx <= 0.7dev collective.recipe.sphinxbuilder = 0.6.3.3 Products.TinyMCE = 1.1.1 + [omelette] recipe = collective.recipe.omelette eggs = ${instance:eggs} packages = ${instance:location}/lib/python ./ + [test] recipe = collective.xmltestreport eggs = ${buildout:package-name} [test] defaults = ['--auto-color', '--auto-progress'] - -[pycoverage] -recipe = zc.recipe.egg -eggs = coverage -scripts = coverage=pycoverage - -[coverage] -recipe = zc.recipe.egg -eggs = coverage -initialization = - sys.argv = sys.argv[:] + ['run', 'bin/test', '-k', '-q', '--xml'] - -[coverage-plain] -recipe = zc.recipe.egg -eggs = coverage -scripts = coverage=coverage-plain -initialization = - exclude = '--omit=' + '${buildout:package-directory}/tests/*' - include = '--include=' + '${buildout:package-directory}/*.py' - sys.argv = sys.argv[:] + ['report', '-i', include, exclude] - -[coverage-xml] -recipe = zc.recipe.egg -eggs = coverage -scripts = coverage=coverage-xml -initialization = - exclude = '--omit=' + '${buildout:package-directory}/tests/*' - include = '--include=' + '${buildout:package-directory}/*.py' - sys.argv = sys.argv[:] + ['xml', '-i', include, exclude] - -[coverage-html] -recipe = zc.recipe.egg -eggs = coverage -scripts = coverage=coverage-html -initialization = - exclude = '--omit=' + '${buildout:package-directory}/tests/*' - include = '--include=' + '${buildout:package-directory}/*.py' - sys.argv = sys.argv[:] + ['html', '-i', include, exclude] - -[jstestdriver-build] -recipe = hexagonit.recipe.download -url = http://js-test-driver.googlecode.com/files/JsTestDriver-1.2.2.jar -download-only = True -destination = parts/jstestdriver -filename = JsTestDriver.jar - -[jstestdriver-build-coverage] -recipe = hexagonit.recipe.download -url = http://js-test-driver.googlecode.com/files/coverage-1.2.2.jar -download-only = True -destination = parts/jstestdriver -filename = coverage.jar - -[jstestdriver] -recipe = collective.recipe.template -input = inline: - #!/bin/sh - java -jar ${buildout:directory}/parts/jstestdriver/JsTestDriver.jar --port 9876 --config ${buildout:package-directory}/tests/jsTestDriver.conf --browser /usr/bin/firefox --tests all --verbose -output = ${buildout:directory}/bin/jstestdriver -mode = 755 - -[pylint] -recipe = zc.recipe.egg -eggs = logilab.pylintinstaller -extra-paths = ${instance:location}/lib/python -entry-points = pylint=pylint.lint:Run -arguments = sys.argv[1:] -arguments = [ - '--output-format=parseable', - '--zope=y', - '--reports=y', - '--disable-msg=E0611,F0401,W0232,E1101,C0103,C0111,R0201,W0201,R0911,R0904,F0220,E1103,R0901,E0211,E0213,E1002,W0622', - '--generated-members=objects', - ] + sys.argv[1:] - -# Disable messages: -# -# E0611: No name %r in module %r. Used when a name cannot be found in a module. -# F0401: Unable to import %r (%s). Used when pylint has been unable to import a module. -# W0232: Class has no __init__ method. Used when a class has no __init__ method, neither its parent classes. -# C0103: Invalid name "%s" (should match %s). Used when the name doesn't match the regular expression associated to its type (constant, variable, class...). -# C0111: Message Missing docstring Description Used when a module, function, class or method has no docstring. Some special methods like init don't necessary require a docstring. Explanation… -# R0201: Method could be a function -# W0201: Attribute %r defined outside __init__ -# R0911: Too many return statements (%s/%s) - -# E0211: Method has no argument -# - Reason: raises an error on zope.interface definitions -# E0213 Method should have "self" as first argument -# - Reason: raises an error on zope.interface definitions -# E1121 Too many positional arguments for function call -# - Reason: ??? -# E1002 Use super on an old style class -# - Reason: super(CommentsViewlet, self).update() raises an error -# W0622 total_comments: Redefining built-in 'object' -# - Reason: top level def function will not work (e.g. for catalog indexers) -# ... -# See http://pylint-messages.wikidot.com/all-messages for a full list. - -[pylint-test] -recipe = collective.recipe.template -input = inline: - #!/bin/sh - if [ -s pylint.log ]; then - rm pylint.log - echo "Old pylint.log file removed" - fi - echo "Running pylint" - find -L ${buildout:package-directory} -regex ".*\.[c]?py" | xargs bin/pylint >> pylint.log - echo "finish" -output = ${buildout:directory}/bin/pylint-test -mode = 755 - -[zptlint] -recipe = zc.recipe.egg -eggs = - zptlint -entry-points = zptlint=zptlint:run - -[zptlint-test] -recipe = collective.recipe.template -input = inline: - #!/bin/sh - if [ -e zptlint.log ]; then - echo "Old zptlint.log file removed" - rm zptlint.log - fi - echo "Running zptlint-test" - TMPL=$(find ${buildout:package-directory} -regex ".*\.[c|z]?pt") - echo "Checking" - echo $TMPL - find ${buildout:package-directory} -regex ".*\.[c|z]?pt" | xargs bin/zptlint > zptlint.log - if [ -s zptlint.log ]; then - echo "Errors were found:" - cat zptlint.log - echo "Errors were written to zptlint.log" - exit 1; - else - echo "No errors found" - rm zptlint.log - fi -output = ${buildout:directory}/bin/zptlint-test -mode = 755 - From 15c681d27f0d10f37ef8b5a99ac94fbff3e29e13 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Wed, 26 Jan 2011 08:06:21 +0000 Subject: [PATCH 12/26] Check if the current user has configured an e-mail address for the email notification option. Refs #11428 svn path=/plone.app.discussion/branches/1.x/; revision=47068 --- CHANGES.txt | 8 ++++++++ plone/app/discussion/browser/comments.py | 13 ++++++++++--- setup.py | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 75bb182..2b64f00 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,14 @@ Changelog ========= +1.0 (2011-01-24) +---------------- + +- Check if the current user has configured an e-mail address for the email + notification option. This fixes http://dev.plone.org/plone/ticket/11428. + [timo] + + 1.0RC2 (2011-01-24) ------------------- diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 0c2a9e4..f7fd9c3 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -106,10 +106,17 @@ class CommentForm(extensible.ExtensibleForm, form.Form): registry = queryUtility(IRegistry) settings = registry.forInterface(IDiscussionSettings, check=False) - portal_membership = getToolByName(self.context, 'portal_membership') + mtool = getToolByName(self.context, 'portal_membership') + member = mtool.getAuthenticatedMember() + member_email = member.getProperty('email') - if not settings.user_notification_enabled or portal_membership.isAnonymousUser(): - self.widgets['user_notification'].mode = interfaces.HIDDEN_MODE + # Hide the user_notification checkbox if user notification is disabled + # or the user is not logged in. Also check if the user has a valid email + # address + if member_email == '' or \ + not settings.user_notification_enabled or \ + mtool.isAnonymousUser(): + self.widgets['user_notification'].mode = interfaces.HIDDEN_MODE def updateActions(self): super(CommentForm, self).updateActions() diff --git a/setup.py b/setup.py index 1c8979a..71fd25a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import sys from setuptools import setup, find_packages -version = '1.0RC2' +version = '1.0dev' install_requires = [ 'setuptools', From 7dfd4ac98c7f08f23cf2736f8b0a186fdf00db27 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 27 Jan 2011 13:51:11 +0000 Subject: [PATCH 13/26] Fix email notification docs. svn path=/plone.app.discussion/branches/1.x/; revision=47094 --- docs/source/email-notification.txt | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/docs/source/email-notification.txt b/docs/source/email-notification.txt index 1384b80..6b5c709 100644 --- a/docs/source/email-notification.txt +++ b/docs/source/email-notification.txt @@ -72,22 +72,7 @@ comment has been added to a page. To create custom email notifications, register a new event subscriber or override an existing one. - -Plone 3 Event Subscribers -------------------------- - -*plone/app/discussion/subscribers.zcml* +*plone/app/discussion/notifications.zcml* .. literalinclude:: ../../plone/app/discussion/notifications.zcml :encoding: utf-8 - :lines: 6-24 - - -Plone 4 Event Subscribers -------------------------- - -*plone/app/discussion/subscribers.zcml* - -.. literalinclude:: ../../plone/app/discussion/notifications.zcml - :encoding: utf-8 - :lines: 25-41 From de4353641bde7ae4127246d15873f12e03490003 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Wed, 2 Feb 2011 19:55:24 +0000 Subject: [PATCH 14/26] Do not check for a comment review workflow when sending out a moderator email notification. This fixes http://dev.plone.org/plone/ticket/11444. Refs #11444 svn path=/plone.app.discussion/branches/1.x/; revision=47189 --- CHANGES.txt | 4 ++++ plone/app/discussion/comment.py | 7 ------- plone/app/discussion/tests/test_notifications.py | 13 ------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2b64f00..9a6ff51 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 1.0 (2011-01-24) ---------------- +- Do not check for a comment review workflow when sending out a moderator email + notification. This fixes http://dev.plone.org/plone/ticket/11444. + [timo] + - Check if the current user has configured an e-mail address for the email notification option. This fixes http://dev.plone.org/plone/ticket/11428. [timo] diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index d66a6bb..f89f02a 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -284,13 +284,6 @@ def notify_moderator(obj, event): if not settings.moderator_notification_enabled: return - # Check if the current workflow implements a pending state. - wf_tool = getToolByName(obj, 'portal_workflow') - comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0] - comment_workflow = wf_tool[comment_workflow] - if 'pending' not in comment_workflow.states: - return - # Get informations that are necessary to send an email mail_host = getToolByName(obj, 'MailHost') portal_url = getToolByName(obj, 'portal_url') diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index ae78ac4..86b05ad 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -256,18 +256,5 @@ class TestModeratorNotificationUnit(PloneTestCase): self.conversation.addComment(comment) self.assertEquals(len(self.mailhost.messages), 0) - def test_do_not_notify_moderator_when_moderation_workflow_is_disabled(self): - # Disable comment moderation and make sure no email is send to the - # moderator. - self.portal.portal_types['Document'].allow_discussion = True - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('one_state_workflow',)) - - comment = createObject('plone.Comment') - comment.text = 'Comment text' - self.conversation.addComment(comment) - self.assertEquals(len(self.mailhost.messages), 0) - def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) From 8da226ee990e076f51606a61cc59cc0fc9beeb7e Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 7 Feb 2011 12:05:20 +0000 Subject: [PATCH 15/26] Prepare 1.0 release. svn path=/plone.app.discussion/branches/1.x/; revision=47293 --- CHANGES.txt | 2 +- docs/source/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9a6ff51..777728d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ Changelog ========= -1.0 (2011-01-24) +1.0 (2011-02-07) ---------------- - Do not check for a comment review workflow when sending out a moderator email diff --git a/docs/source/conf.py b/docs/source/conf.py index 2276b12..0f65223 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -53,7 +53,7 @@ copyright = u'2010, Timo Stollenwerk - Plone Foundation' # The short X.Y version. version = '1.0' # The full version, including alpha/beta/rc tags. -release = '1.0RC2' +release = '1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 29cf266b2521b49da07fbceb5c3294770ae7ca28 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 7 Feb 2011 12:06:03 +0000 Subject: [PATCH 16/26] Prepare 1.0 release. svn path=/plone.app.discussion/branches/1.x/; revision=47294 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 71fd25a..80e7090 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import sys from setuptools import setup, find_packages -version = '1.0dev' +version = '1.0' install_requires = [ 'setuptools', From 88307070b7599c6d71759418408bb01819815061 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 7 Feb 2011 12:25:41 +0000 Subject: [PATCH 17/26] Prepare plone.app.discussion 1.0. svn path=/plone.app.discussion/branches/1.x/; revision=47296 --- versions.plone4.cfg | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/versions.plone4.cfg b/versions.plone4.cfg index 0184fbf..852a261 100644 --- a/versions.plone4.cfg +++ b/versions.plone4.cfg @@ -4,38 +4,34 @@ Products.PrintingMailHost = 0.7 Sphinx-PyPI-upload = 0.2.1 collective.recipe.omelette = 0.10 collective.recipe.template = 1.8 -collective.xmltestreport = 1.1 +collective.xmltestreport = 1.2.1 collective.z3cform.datetimewidget = 1.0.4 -coverage = 3.4 -hexagonit.recipe.download = 1.4.1 interlude = 1.1.1 ipython = 0.10.1 jarn.mkrelease = 3.0.9 -logilab.pylintinstaller = 0.15.2 -mr.developer = 1.16 +mr.developer = 1.17 plone.app.testing = 4.0a4 plone.autoform = 1.0b5 plone.supermodel = 1.0b6 plone.testing = 4.0a4 recaptcha-client = 1.0.5 -repoze.sphinx.autointerface = 0.5 -zptlint = 0.2.4 +repoze.sphinx.autointerface = 0.6.1 #Required by: #collective.akismet 1.0b2dev akismet = 0.2.0 #Required by: -#plone.app.discussion 1.0bRC1 +#plone.app.discussion 1.0 collective.autopermission = 1.0b1 #Required by: -#plone.app.discussion 1.0bRC1 +#plone.app.discussion 1.0 plone.app.uuid = 1.0b2 #Required by: -#plone.app.discussion 1.0bRC1 -plone.registry = 1.0b3 +#plone.app.discussion 1.0 +plone.registry = 1.0b4 #Required by: #plone.app.uuid 1.0b2 @@ -66,5 +62,5 @@ z3c.batching = 1.1.0 z3c.formwidget.query = 0.5 #Required by: -#collective.xmltestreport 1.1 +#collective.xmltestreport 1.2.1 zope.testrunner = 4.0.0 From 4965c2bc2d5da6d48c735a48375bc2265a3774fc Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 7 Mar 2011 16:10:14 +0000 Subject: [PATCH 18/26] Updated CHANGES.txt svn path=/plone.app.discussion/branches/1.x/; revision=47960 --- CHANGES.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 777728d..f92418a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,12 @@ Changelog ========= +1.1 (Unreleased) +------------------ + +- Added Afrikaans translations + [jcbrand] + 1.0 (2011-02-07) ---------------- From 65aab05d1b66758fc2f49651323c0ec82a2c2794 Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Wed, 9 Mar 2011 03:03:17 +0000 Subject: [PATCH 19/26] Fixed test failure for the default user portrait, which changed from defaultUser.gif to defaultUser.png in Products.PlonePAS 4.0.5. Backport if maurits changes to the trunk svn path=/plone.app.discussion/branches/1.x/; revision=47996 --- CHANGES.txt | 6 +++++- plone/app/discussion/tests/test_comments_viewlet.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f92418a..d48bb95 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,9 +4,13 @@ Changelog 1.1 (Unreleased) ------------------ -- Added Afrikaans translations +- Added Afrikaans translations [jcbrand] +- Fixed test failure for the default user portrait, which changed from + defaultUser.gif to defaultUser.png in Products.PlonePAS 4.0.5. + [maurits] + 1.0 (2011-02-07) ---------------- diff --git a/plone/app/discussion/tests/test_comments_viewlet.py b/plone/app/discussion/tests/test_comments_viewlet.py index 2160605..35dea51 100644 --- a/plone/app/discussion/tests/test_comments_viewlet.py +++ b/plone/app/discussion/tests/test_comments_viewlet.py @@ -431,8 +431,12 @@ class TestCommentsViewlet(PloneTestCase): self.viewlet.update() portrait_url = self.viewlet.get_commenter_portrait('jim') - # Check if the correct default member image URL is returned - self.assertEquals(portrait_url, 'http://nohost/plone/defaultUser.gif') + # Check if the correct default member image URL is returned. + # Note that Products.PlonePAS 4.0.5 and later have .png and + # earlier versions have .gif. + self.failUnless(portrait_url in + ('http://nohost/plone/defaultUser.png', + 'http://nohost/plone/defaultUser.gif')) def test_anonymous_discussion_allowed(self): # Anonymous discussion is not allowed by default From 39d692f9b823a60979b19116bdf4d755978a39d3 Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Wed, 9 Mar 2011 03:07:29 +0000 Subject: [PATCH 20/26] Trigger failure for objects with unicode titles in string svn path=/plone.app.discussion/branches/1.x/; revision=47997 --- plone/app/discussion/tests/test_notifications.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index 86b05ad..9324e0b 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -1,3 +1,5 @@ +# coding=utf-8 + import unittest from Acquisition import aq_base @@ -195,6 +197,9 @@ class TestModeratorNotificationUnit(PloneTestCase): self.loginAsPortalOwner() self.portal.invokeFactory('Document', 'doc1') self.portal_discussion = self.portal.portal_discussion + # Archetypes content types store data as utf-8 encoded strings + # The missing u in front of a string is therefor not missing + self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"? self.conversation = IConversation(self.portal.doc1) def beforeTearDown(self): From de9ebea4991833a0f076b9a985ab1ea81927d79f Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Wed, 9 Mar 2011 03:07:46 +0000 Subject: [PATCH 21/26] Ups, there is a nother unicode problem svn path=/plone.app.discussion/branches/1.x/; revision=47998 --- plone/app/discussion/tests/test_notifications.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index 9324e0b..27a4909 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -46,6 +46,9 @@ class TestUserNotificationUnit(PloneTestCase): self.loginAsPortalOwner() self.portal.invokeFactory('Document', 'doc1') self.portal_discussion = self.portal.portal_discussion + # Archetypes content types store data as utf-8 encoded strings + # The missing u in front of a string is therefor not missing + self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"? self.conversation = IConversation(self.portal.doc1) def beforeTearDown(self): From 882e9e028f26dec518b3a0e2c1062e4c6769f9a2 Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Wed, 9 Mar 2011 03:07:59 +0000 Subject: [PATCH 22/26] Take care of properly converting titles to unicode svn path=/plone.app.discussion/branches/1.x/; revision=47999 --- plone/app/discussion/comment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index f89f02a..76b91aa 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -235,7 +235,7 @@ def notify_user(obj, event): context=obj.REQUEST) message = translate(Message( MAIL_NOTIFICATION_MESSAGE, - mapping={'title': content_object.title, + mapping={'title': safe_unicode(content_object.title), 'link': content_object.absolute_url()}), context=obj.REQUEST) for email in emails: @@ -302,7 +302,7 @@ def notify_moderator(obj, event): #comment = conversation.getComments().next() subject = translate(_(u"A comment has been posted."), context=obj.REQUEST) message = translate(Message(MAIL_NOTIFICATION_MESSAGE, - mapping={'title': content_object.title, + mapping={'title': safe_unicode(content_object.title), 'link': content_object.absolute_url()}), context=obj.REQUEST) From 6413096336ccf868deda31a40ff75578b603e42e Mon Sep 17 00:00:00 2001 From: David Glick Date: Thu, 7 Apr 2011 19:22:42 +0000 Subject: [PATCH 23/26] bump version svn path=/plone.app.discussion/branches/1.x/; revision=48522 --- CHANGES.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index d48bb95..eebc2c4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,7 +2,7 @@ Changelog ========= 1.1 (Unreleased) ------------------- +---------------- - Added Afrikaans translations [jcbrand] diff --git a/setup.py b/setup.py index 80e7090..19039b9 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import sys from setuptools import setup, find_packages -version = '1.0' +version = '1.1dev' install_requires = [ 'setuptools', From 9aea1915c135206121c325b3fe1c734ad81b005e Mon Sep 17 00:00:00 2001 From: David Glick Date: Thu, 7 Apr 2011 20:02:27 +0000 Subject: [PATCH 24/26] add moderator email setting svn path=/plone.app.discussion/branches/1.x/; revision=48523 --- plone/app/discussion/comment.py | 15 ++++++++++---- plone/app/discussion/interfaces.py | 10 ++++++++++ .../discussion/tests/test_notifications.py | 20 ++++++++++++++++--- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 76b91aa..63621e6 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -269,9 +269,12 @@ def notify_user(obj, event): def notify_moderator(obj, event): """Tell the moderator when a comment needs attention. - This method sends an email to the site admin (mail control panel setting) - if comment moderation is enabled and a new comment has been added that - needs to be approved. + This method sends an email to the moderator if comment moderation is + enabled and a new comment has been added that needs to be approved. + + Configure the moderator e-mail address in the discussion control panel. + If no moderator is configured but moderator notifications are turned on, + the site admin email (from the mail control panel) will be used. This requires the moderator_notification to be enabled in the discussion control panel and the comment_review_workflow enabled for the comment @@ -289,7 +292,11 @@ def notify_moderator(obj, event): portal_url = getToolByName(obj, 'portal_url') portal = portal_url.getPortalObject() sender = portal.getProperty('email_from_address') - mto = portal.getProperty('email_from_address') + + if settings.moderator_email: + mto = settings.moderator_email + else: + mto = sender # Check if a sender address is available if not sender: diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index adb57e4..08e2c11 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -113,6 +113,16 @@ class IDiscussionSettings(Interface): required=False, default=False, ) + + moderator_email = schema.ASCIILine( + title = _(u'label_moderator_email', default=u'Moderator Email Address'), + description = _(u'help_moderator_email', + default=u"Address to which moderator notifications " + u"will be sent. If not specified, the Site " + u"'From' Address from the mail control panel " + u"will be used."), + required = False, + ) user_notification_enabled = schema.Bool( title=_(u"label_user_notification_enabled", diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index 27a4909..45cda4b 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -16,7 +16,6 @@ from Products.CMFPlone.tests.utils import MockMailHost from plone.registry.interfaces import IRegistry from plone.app.discussion.interfaces import IConversation -from plone.app.discussion.interfaces import IDiscussionSettings from plone.app.discussion.tests.layer import DiscussionLayer @@ -38,7 +37,6 @@ class TestUserNotificationUnit(PloneTestCase): # Enable user notification setting registry = queryUtility(IRegistry) - settings = registry.forInterface(IDiscussionSettings) registry['plone.app.discussion.interfaces.IDiscussionSettings' + '.user_notification_enabled'] = True @@ -89,7 +87,6 @@ class TestUserNotificationUnit(PloneTestCase): def test_do_not_notify_user_when_notification_is_disabled(self): # Disable user notification and make sure no email is send to the user. registry = queryUtility(IRegistry) - settings = registry.forInterface(IDiscussionSettings) registry['plone.app.discussion.interfaces.IDiscussionSettings.' + 'user_notification_enabled'] = False @@ -241,6 +238,23 @@ class TestModeratorNotificationUnit(PloneTestCase): #'...Another t=C3=A4st message...You are receiving this mail because # T=C3=A4st user\ntest@plone.test...is sending feedback about the site # you administer at... + + def test_notify_moderator_specific_address(self): + # A moderator email address can be specified in the control panel. + registry = queryUtility(IRegistry) + registry['plone.app.discussion.interfaces.IDiscussionSettings' + + '.moderator_email'] = 'test@example.com' + + comment = createObject('plone.Comment') + comment.text = 'Comment text' + self.conversation.addComment(comment) + + self.assertEquals(len(self.mailhost.messages), 1) + msg = self.mailhost.messages[0] + if not isinstance(msg, str): + self.failUnless('test@example.com' in msg.mto) + else: + self.failUnless('To: test@example.com' in msg) def test_do_not_notify_moderator_when_no_sender_is_available(self): # Set sender mail address to nonw and make sure no email is send to the From a1a9042b73e27aea3e1afc35d1c4d6a56e9e1f06 Mon Sep 17 00:00:00 2001 From: David Glick Date: Thu, 7 Apr 2011 21:35:04 +0000 Subject: [PATCH 25/26] changelog svn path=/plone.app.discussion/branches/1.x/; revision=48528 --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index eebc2c4..88add70 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 1.1 (Unreleased) ---------------- +- Add a moderator_email setting to control where moderator notifications are + sent. + [davisagli] + - Added Afrikaans translations [jcbrand] From d323d3728533e851868c34f353a213ad8080897f Mon Sep 17 00:00:00 2001 From: David Glick Date: Fri, 8 Apr 2011 20:20:34 +0000 Subject: [PATCH 26/26] add upgrade step for moderator_email setting svn path=/plone.app.discussion/branches/1.x/; revision=48555 --- plone/app/discussion/configure.zcml | 1 + plone/app/discussion/profiles/default/metadata.xml | 2 +- plone/app/discussion/upgrades.py | 8 ++++++++ plone/app/discussion/upgrades.zcml | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 plone/app/discussion/upgrades.py create mode 100644 plone/app/discussion/upgrades.zcml diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index e628131..1c5a8b9 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -27,6 +27,7 @@ + diff --git a/plone/app/discussion/profiles/default/metadata.xml b/plone/app/discussion/profiles/default/metadata.xml index 0529698..c9bbe47 100644 --- a/plone/app/discussion/profiles/default/metadata.xml +++ b/plone/app/discussion/profiles/default/metadata.xml @@ -1,5 +1,5 @@ - 1 + 2 profile-plone.app.registry:default diff --git a/plone/app/discussion/upgrades.py b/plone/app/discussion/upgrades.py new file mode 100644 index 0000000..bf9df71 --- /dev/null +++ b/plone/app/discussion/upgrades.py @@ -0,0 +1,8 @@ +from zope.component import getUtility +from plone.registry.interfaces import IRegistry +from plone.app.discussion.interfaces import IDiscussionSettings + + +def update_registry(context): + registry = getUtility(IRegistry) + registry.registerInterface(IDiscussionSettings) diff --git a/plone/app/discussion/upgrades.zcml b/plone/app/discussion/upgrades.zcml new file mode 100644 index 0000000..852f2e6 --- /dev/null +++ b/plone/app/discussion/upgrades.zcml @@ -0,0 +1,14 @@ + + + + +