Always use zope.component getUtility instead of queryUtility.
svn path=/plone.app.discussion/trunk/; revision=37751
This commit is contained in:
@@ -13,7 +13,7 @@ from zope import interface, schema
|
||||
|
||||
from zope.annotation import factory
|
||||
|
||||
from zope.component import adapts, provideAdapter, queryUtility
|
||||
from zope.component import adapts, provideAdapter, getUtility
|
||||
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
||||
|
||||
from zope.interface import Interface, implements
|
||||
@@ -54,7 +54,7 @@ class CaptchaExtender(extensible.FormExtender):
|
||||
self.request = request
|
||||
self.form = form
|
||||
|
||||
registry = queryUtility(IRegistry)
|
||||
registry = getUtility(IRegistry)
|
||||
settings = registry.forInterface(IDiscussionSettings)
|
||||
self.captcha = settings.captcha
|
||||
portal_membership = getToolByName(self.context, 'portal_membership')
|
||||
@@ -75,4 +75,4 @@ class CaptchaExtender(extensible.FormExtender):
|
||||
# message to the top
|
||||
self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE
|
||||
self.move('captcha', before='author_name', prefix='')
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from zope import interface, schema
|
||||
|
||||
from zope.annotation import IAttributeAnnotatable
|
||||
|
||||
from zope.component import createObject, getMultiAdapter, queryUtility
|
||||
from zope.component import createObject, getMultiAdapter, getUtility
|
||||
|
||||
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
|
||||
|
||||
# XXX: Author notification code
|
||||
#registry = queryUtility(IRegistry)
|
||||
#registry = getUtility(IRegistry)
|
||||
#settings = registry.forInterface(IDiscussionSettings)
|
||||
#if not settings.user_notification_enabled:
|
||||
# self.widgets['author_notification'].mode = interfaces.HIDDEN_MODE
|
||||
@@ -115,7 +115,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
author_notification = None
|
||||
|
||||
# Captcha check for anonymous users (if Captcha is enabled)
|
||||
registry = queryUtility(IRegistry)
|
||||
registry = getUtility(IRegistry)
|
||||
settings = registry.forInterface(IDiscussionSettings)
|
||||
portal_membership = getToolByName(self.context, 'portal_membership')
|
||||
if settings.captcha != 'disabled' and portal_membership.isAnonymousUser():
|
||||
@@ -304,13 +304,13 @@ class CommentsViewlet(ViewletBase):
|
||||
|
||||
def anonymous_discussion_allowed(self):
|
||||
# Check if anonymous comments are allowed in the registry
|
||||
registry = queryUtility(IRegistry)
|
||||
registry = getUtility(IRegistry)
|
||||
settings = registry.forInterface(IDiscussionSettings)
|
||||
return settings.anonymous_comments
|
||||
|
||||
def show_commenter_image(self):
|
||||
# Check if showing commenter image is enabled in the registry
|
||||
registry = queryUtility(IRegistry)
|
||||
registry = getUtility(IRegistry)
|
||||
settings = registry.forInterface(IDiscussionSettings)
|
||||
return settings.show_commenter_image
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from Products.Five.browser import BrowserView
|
||||
|
||||
from zope.component import queryUtility
|
||||
from plone.registry.interfaces import IRegistry
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from plone.app.registry.browser import controlpanel
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from z3c.form import validator
|
||||
|
||||
from z3c.form.interfaces import IValidator
|
||||
|
||||
from zope.component import getMultiAdapter, provideAdapter, queryUtility
|
||||
from zope.component import getMultiAdapter, provideAdapter, getUtility
|
||||
|
||||
from zope.schema import ValidationError
|
||||
|
||||
@@ -54,7 +54,7 @@ class CaptchaValidator(validator.SimpleFieldValidator):
|
||||
|
||||
data = self.request.form
|
||||
|
||||
registry = queryUtility(IRegistry)
|
||||
registry = getUtility(IRegistry)
|
||||
settings = registry.forInterface(IDiscussionSettings)
|
||||
|
||||
if settings.captcha != 'disabled':
|
||||
@@ -72,4 +72,3 @@ class CaptchaValidator(validator.SimpleFieldValidator):
|
||||
# Register Captcha validator for the Captcha field in the ICaptcha Form
|
||||
validator.WidgetValidatorDiscriminators(CaptchaValidator,
|
||||
field=ICaptcha['captcha'])
|
||||
|
||||
Reference in New Issue
Block a user