revert r37751.
svn path=/plone.app.discussion/trunk/; revision=37752
This commit is contained in:
parent
eabf3bc890
commit
cac0bae7a5
@ -4,9 +4,6 @@ Changelog
|
|||||||
1.0b5 (unreleased)
|
1.0b5 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* Always use zope.component getUtility instead of queryUtility.
|
|
||||||
[timo]
|
|
||||||
|
|
||||||
* Added norwegian translation.
|
* Added norwegian translation.
|
||||||
[ggozad]
|
[ggozad]
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from zope import interface, schema
|
|||||||
|
|
||||||
from zope.annotation import factory
|
from zope.annotation import factory
|
||||||
|
|
||||||
from zope.component import adapts, provideAdapter, getUtility
|
from zope.component import adapts, provideAdapter, queryUtility
|
||||||
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
||||||
|
|
||||||
from zope.interface import Interface, implements
|
from zope.interface import Interface, implements
|
||||||
@ -54,7 +54,7 @@ class CaptchaExtender(extensible.FormExtender):
|
|||||||
self.request = request
|
self.request = request
|
||||||
self.form = form
|
self.form = form
|
||||||
|
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
self.captcha = settings.captcha
|
self.captcha = settings.captcha
|
||||||
portal_membership = getToolByName(self.context, 'portal_membership')
|
portal_membership = getToolByName(self.context, 'portal_membership')
|
||||||
@ -75,4 +75,4 @@ class CaptchaExtender(extensible.FormExtender):
|
|||||||
# message to the top
|
# message to the top
|
||||||
self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE
|
self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE
|
||||||
self.move('captcha', before='author_name', prefix='')
|
self.move('captcha', before='author_name', prefix='')
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from zope import interface, schema
|
|||||||
|
|
||||||
from zope.annotation import IAttributeAnnotatable
|
from zope.annotation import IAttributeAnnotatable
|
||||||
|
|
||||||
from zope.component import createObject, getMultiAdapter, getUtility
|
from zope.component import createObject, getMultiAdapter, queryUtility
|
||||||
|
|
||||||
from zope.interface import Interface, implements, alsoProvides
|
from zope.interface import Interface, implements, alsoProvides
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
||||||
|
|
||||||
# XXX: Author notification code
|
# XXX: Author notification code
|
||||||
#registry = getUtility(IRegistry)
|
#registry = queryUtility(IRegistry)
|
||||||
#settings = registry.forInterface(IDiscussionSettings)
|
#settings = registry.forInterface(IDiscussionSettings)
|
||||||
#if not settings.user_notification_enabled:
|
#if not settings.user_notification_enabled:
|
||||||
# self.widgets['author_notification'].mode = interfaces.HIDDEN_MODE
|
# self.widgets['author_notification'].mode = interfaces.HIDDEN_MODE
|
||||||
@ -115,7 +115,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
author_notification = None
|
author_notification = None
|
||||||
|
|
||||||
# Captcha check for anonymous users (if Captcha is enabled)
|
# Captcha check for anonymous users (if Captcha is enabled)
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
portal_membership = getToolByName(self.context, 'portal_membership')
|
portal_membership = getToolByName(self.context, 'portal_membership')
|
||||||
if settings.captcha != 'disabled' and portal_membership.isAnonymousUser():
|
if settings.captcha != 'disabled' and portal_membership.isAnonymousUser():
|
||||||
@ -304,13 +304,13 @@ class CommentsViewlet(ViewletBase):
|
|||||||
|
|
||||||
def anonymous_discussion_allowed(self):
|
def anonymous_discussion_allowed(self):
|
||||||
# Check if anonymous comments are allowed in the registry
|
# Check if anonymous comments are allowed in the registry
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
return settings.anonymous_comments
|
return settings.anonymous_comments
|
||||||
|
|
||||||
def show_commenter_image(self):
|
def show_commenter_image(self):
|
||||||
# Check if showing commenter image is enabled in the registry
|
# Check if showing commenter image is enabled in the registry
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
return settings.show_commenter_image
|
return settings.show_commenter_image
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
from Products.Five.browser import BrowserView
|
||||||
|
|
||||||
|
from zope.component import queryUtility
|
||||||
|
from plone.registry.interfaces import IRegistry
|
||||||
|
|
||||||
from plone.app.registry.browser import controlpanel
|
from plone.app.registry.browser import controlpanel
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from z3c.form import validator
|
|||||||
|
|
||||||
from z3c.form.interfaces import IValidator
|
from z3c.form.interfaces import IValidator
|
||||||
|
|
||||||
from zope.component import getMultiAdapter, provideAdapter, getUtility
|
from zope.component import getMultiAdapter, provideAdapter, queryUtility
|
||||||
|
|
||||||
from zope.schema import ValidationError
|
from zope.schema import ValidationError
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class CaptchaValidator(validator.SimpleFieldValidator):
|
|||||||
|
|
||||||
data = self.request.form
|
data = self.request.form
|
||||||
|
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
|
|
||||||
if settings.captcha != 'disabled':
|
if settings.captcha != 'disabled':
|
||||||
@ -72,3 +72,4 @@ class CaptchaValidator(validator.SimpleFieldValidator):
|
|||||||
# Register Captcha validator for the Captcha field in the ICaptcha Form
|
# Register Captcha validator for the Captcha field in the ICaptcha Form
|
||||||
validator.WidgetValidatorDiscriminators(CaptchaValidator,
|
validator.WidgetValidatorDiscriminators(CaptchaValidator,
|
||||||
field=ICaptcha['captcha'])
|
field=ICaptcha['captcha'])
|
||||||
|
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||||||
from zope.annotation.interfaces import IAnnotations, IAnnotatable
|
from zope.annotation.interfaces import IAnnotations, IAnnotatable
|
||||||
|
|
||||||
from zope.component.factory import Factory
|
from zope.component.factory import Factory
|
||||||
from zope.component import getUtility
|
from zope.component import queryUtility
|
||||||
|
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ def notify_user(obj, event):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Check if user notification is enabled
|
# Check if user notification is enabled
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
if not settings.user_notification_enabled:
|
if not settings.user_notification_enabled:
|
||||||
return
|
return
|
||||||
@ -208,7 +208,7 @@ def notify_moderator(obj, index):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Check if moderator notification is enabled
|
# Check if moderator notification is enabled
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
if not settings.moderator_notification_enabled:
|
if not settings.moderator_notification_enabled:
|
||||||
return
|
return
|
||||||
|
@ -17,7 +17,7 @@ from persistent import Persistent
|
|||||||
from plone.registry.interfaces import IRegistry
|
from plone.registry.interfaces import IRegistry
|
||||||
|
|
||||||
from zope.interface import implements, implementer
|
from zope.interface import implements, implementer
|
||||||
from zope.component import adapts, adapter, getUtility
|
from zope.component import adapts, adapter, queryUtility
|
||||||
|
|
||||||
from zope.annotation.interfaces import IAnnotations, IAnnotatable
|
from zope.annotation.interfaces import IAnnotations, IAnnotatable
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class Conversation(Traversable, Persistent, Explicit):
|
|||||||
# Returns True if discussion is enabled on the conversation
|
# Returns True if discussion is enabled on the conversation
|
||||||
|
|
||||||
# Fetch discussion registry
|
# Fetch discussion registry
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
|
|
||||||
# Check if discussion is allowed globally
|
# Check if discussion is allowed globally
|
||||||
|
@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
|||||||
|
|
||||||
from plone.registry import Registry
|
from plone.registry import Registry
|
||||||
|
|
||||||
from zope.component import createObject, getUtility
|
from zope.component import createObject, queryUtility
|
||||||
|
|
||||||
from Acquisition import aq_base, aq_parent, aq_inner
|
from Acquisition import aq_base, aq_parent, aq_inner
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class TestCommentsViewlet(PloneTestCase):
|
|||||||
# Anonymous discussion is not allowed by default
|
# Anonymous discussion is not allowed by default
|
||||||
self.failIf(self.viewlet.anonymous_discussion_allowed())
|
self.failIf(self.viewlet.anonymous_discussion_allowed())
|
||||||
# Allow anonymous discussion
|
# Allow anonymous discussion
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.anonymous_comments'] = True
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.anonymous_comments'] = True
|
||||||
# Test if anonymous discussion is allowed for the viewlet
|
# Test if anonymous discussion is allowed for the viewlet
|
||||||
@ -256,7 +256,7 @@ class TestCommentsViewlet(PloneTestCase):
|
|||||||
|
|
||||||
def test_show_commenter_image(self):
|
def test_show_commenter_image(self):
|
||||||
self.failUnless(self.viewlet.show_commenter_image())
|
self.failUnless(self.viewlet.show_commenter_image())
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.show_commenter_image'] = False
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.show_commenter_image'] = False
|
||||||
self.failIf(self.viewlet.show_commenter_image())
|
self.failIf(self.viewlet.show_commenter_image())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from zope.component import createObject, getUtility
|
from zope.component import createObject, queryUtility
|
||||||
|
|
||||||
from Acquisition import aq_base, aq_parent, aq_inner
|
from Acquisition import aq_base, aq_parent, aq_inner
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ class ConversationTest(PloneTestCase):
|
|||||||
self.assertEquals(conversation.enabled(), True)
|
self.assertEquals(conversation.enabled(), True)
|
||||||
|
|
||||||
# Disable commenting in the registry
|
# Disable commenting in the registry
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
settings.globally_enabled = False
|
settings.globally_enabled = False
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ class ConversationTest(PloneTestCase):
|
|||||||
self.assertEquals(conversation.enabled(), True)
|
self.assertEquals(conversation.enabled(), True)
|
||||||
|
|
||||||
# Disable commenting in the registry
|
# Disable commenting in the registry
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
settings.globally_enabled = False
|
settings.globally_enabled = False
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ class ConversationTest(PloneTestCase):
|
|||||||
def test_is_discussion_allowed_on_content_object(self):
|
def test_is_discussion_allowed_on_content_object(self):
|
||||||
# Allow discussion on a single content object
|
# Allow discussion on a single content object
|
||||||
|
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
|
|
||||||
# Create a conversation.
|
# Create a conversation.
|
||||||
|
@ -9,7 +9,7 @@ from zope.app.container.interfaces import IObjectAddedEvent
|
|||||||
|
|
||||||
from zope.component import createObject
|
from zope.component import createObject
|
||||||
from zope.component import getSiteManager
|
from zope.component import getSiteManager
|
||||||
from zope.component import getUtility
|
from zope.component import queryUtility
|
||||||
|
|
||||||
from Products.PloneTestCase.ptc import PloneTestCase
|
from Products.PloneTestCase.ptc import PloneTestCase
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ from plone.app.discussion.tests.layer import DiscussionLayer
|
|||||||
# self.mailhost = self.portal.MailHost
|
# self.mailhost = self.portal.MailHost
|
||||||
#
|
#
|
||||||
# # Enable user notification setting
|
# # Enable user notification setting
|
||||||
# registry = getUtility(IRegistry)
|
# registry = queryUtility(IRegistry)
|
||||||
# settings = registry.forInterface(IDiscussionSettings)
|
# settings = registry.forInterface(IDiscussionSettings)
|
||||||
# registry['plone.app.discussion.interfaces.IDiscussionSettings.user_notification_enabled'] = True
|
# registry['plone.app.discussion.interfaces.IDiscussionSettings.user_notification_enabled'] = True
|
||||||
#
|
#
|
||||||
@ -88,7 +88,7 @@ from plone.app.discussion.tests.layer import DiscussionLayer
|
|||||||
#
|
#
|
||||||
# def test_do_not_notify_user_when_notification_is_disabled(self):
|
# def test_do_not_notify_user_when_notification_is_disabled(self):
|
||||||
# # Disable user notification and make sure no email is send to the user.
|
# # Disable user notification and make sure no email is send to the user.
|
||||||
# registry = getUtility(IRegistry)
|
# registry = queryUtility(IRegistry)
|
||||||
# settings = registry.forInterface(IDiscussionSettings)
|
# settings = registry.forInterface(IDiscussionSettings)
|
||||||
# registry['plone.app.discussion.interfaces.IDiscussionSettings.user_notification_enabled'] = False
|
# registry['plone.app.discussion.interfaces.IDiscussionSettings.user_notification_enabled'] = False
|
||||||
#
|
#
|
||||||
@ -162,7 +162,7 @@ class TestModeratorNotificationUnit(PloneTestCase):
|
|||||||
('comment_review_workflow',))
|
('comment_review_workflow',))
|
||||||
|
|
||||||
# Enable moderator notification setting
|
# Enable moderator notification setting
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.moderator_notification_enabled'] = True
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.moderator_notification_enabled'] = True
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class TestModeratorNotificationUnit(PloneTestCase):
|
|||||||
def test_do_not_notify_moderator_when_notification_is_disabled(self):
|
def test_do_not_notify_moderator_when_notification_is_disabled(self):
|
||||||
# Disable moderator notification setting and make sure no email is send
|
# Disable moderator notification setting and make sure no email is send
|
||||||
# to the moderator.
|
# to the moderator.
|
||||||
registry = getUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings)
|
settings = registry.forInterface(IDiscussionSettings)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.moderator_notification_enabled'] = False
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.moderator_notification_enabled'] = False
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ BBB support for the old portal_discussion is provided in the bbb package.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import interface
|
from zope import interface
|
||||||
from zope.component import getUtility
|
from zope.component import queryUtility
|
||||||
|
|
||||||
from interfaces import ICommentingTool, IComment
|
from interfaces import ICommentingTool, IComment
|
||||||
|
|
||||||
@ -68,13 +68,13 @@ class CommentingTool(UniqueObject, SimpleItem):
|
|||||||
def index_object(obj, event):
|
def index_object(obj, event):
|
||||||
"""Index the object when added to the conversation
|
"""Index the object when added to the conversation
|
||||||
"""
|
"""
|
||||||
tool = getUtility(ICommentingTool)
|
tool = queryUtility(ICommentingTool)
|
||||||
if tool is not None:
|
if tool is not None:
|
||||||
tool.indexObject(obj)
|
tool.indexObject(obj)
|
||||||
|
|
||||||
def unindex_object(obj, event):
|
def unindex_object(obj, event):
|
||||||
"""Unindex the object when removed
|
"""Unindex the object when removed
|
||||||
"""
|
"""
|
||||||
tool = getUtility(ICommentingTool)
|
tool = queryUtility(ICommentingTool)
|
||||||
if tool is not None:
|
if tool is not None:
|
||||||
tool.unindexObject(obj)
|
tool.unindexObject(obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user