Test
This commit is contained in:
@@ -12,29 +12,30 @@ from z3c.form import interfaces
|
||||
from z3c.form.field import Fields
|
||||
from zope import interface
|
||||
from zope.annotation import factory
|
||||
from zope.component import adapts
|
||||
from zope.component import adapter
|
||||
from zope.component import queryUtility
|
||||
from zope.interface import Interface
|
||||
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
||||
|
||||
|
||||
@adapter(Comment)
|
||||
@interface.implementer(ICaptcha)
|
||||
class Captcha(Persistent):
|
||||
"""Captcha input field.
|
||||
"""
|
||||
adapts(Comment)
|
||||
captcha = u""
|
||||
captcha = u''
|
||||
|
||||
|
||||
Captcha = factory(Captcha)
|
||||
|
||||
|
||||
# context, request, form
|
||||
@adapter(Interface, IDefaultBrowserLayer, CommentForm)
|
||||
class CaptchaExtender(extensible.FormExtender):
|
||||
"""Extends the comment form with a Captcha. This Captcha extender is only
|
||||
registered when a plugin is installed that provides the
|
||||
"plone.app.discussion-captcha" feature.
|
||||
"""
|
||||
# context, request, form
|
||||
adapts(Interface, IDefaultBrowserLayer, CommentForm)
|
||||
|
||||
fields = Fields(ICaptcha)
|
||||
|
||||
@@ -65,5 +66,3 @@ class CaptchaExtender(extensible.FormExtender):
|
||||
self.form.fields['captcha'].widgetFactory = NorobotsFieldWidget
|
||||
else:
|
||||
self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# coding: utf-8
|
||||
from AccessControl import getSecurityManager
|
||||
from Acquisition import aq_inner
|
||||
from Acquisition import aq_parent
|
||||
@@ -112,6 +112,5 @@ class EditCommentForm(CommentForm):
|
||||
type='info')
|
||||
return self._redirect(target=self.context.absolute_url())
|
||||
|
||||
EditComment = wrap_form(EditCommentForm)
|
||||
|
||||
# EOF
|
||||
EditComment = wrap_form(EditCommentForm)
|
||||
|
||||
@@ -106,11 +106,11 @@
|
||||
</td>
|
||||
<td>
|
||||
<span tal:content="python:item.author_name or item.Creator">Name</span>
|
||||
<tal:email tal:condition="email"><br /><a
|
||||
<tal:email tal:condition="email"><br /><a
|
||||
tal:attributes="href string:mailto:$email"
|
||||
tal:content="email">Email</a></tal:email>
|
||||
</td>
|
||||
<td tal:content="python:toLocalizedTime(item.ModificationDate,
|
||||
<td tal:content="python:toLocalizedTime(item.ModificationDate,
|
||||
long_format=1)" />
|
||||
<td>
|
||||
<a tal:attributes="href item/getURL"
|
||||
|
||||
@@ -4,7 +4,7 @@ IDiscussion container for the context, from which traversal will continue
|
||||
into an actual comment object.
|
||||
"""
|
||||
from plone.app.discussion.interfaces import IConversation
|
||||
from zope.component import adapts
|
||||
from zope.component import adapter
|
||||
from zope.component import queryAdapter
|
||||
from zope.interface import implementer
|
||||
from zope.interface import Interface
|
||||
@@ -13,6 +13,7 @@ from zope.traversing.interfaces import ITraversable
|
||||
from zope.traversing.interfaces import TraversalError
|
||||
|
||||
|
||||
@adapter(Interface, IBrowserRequest)
|
||||
@implementer(ITraversable)
|
||||
class ConversationNamespace(object):
|
||||
"""Allow traversal into a conversation via a ++conversation++name
|
||||
@@ -21,7 +22,6 @@ class ConversationNamespace(object):
|
||||
(unnamed) adapter. This is to work around a bug in OFS.Traversable which
|
||||
does not allow traversal to namespaces with an empty string name.
|
||||
"""
|
||||
adapts(Interface, IBrowserRequest)
|
||||
|
||||
def __init__(self, context, request=None):
|
||||
self.context = context
|
||||
|
||||
@@ -8,7 +8,7 @@ from plone.app.discussion.interfaces import IDiscussionSettings
|
||||
from plone.registry.interfaces import IRegistry
|
||||
from z3c.form import validator
|
||||
from z3c.form.interfaces import IValidator
|
||||
from zope.component import adapts
|
||||
from zope.component import adapter
|
||||
from zope.component import getMultiAdapter
|
||||
from zope.component import queryUtility
|
||||
from zope.interface import implementer
|
||||
@@ -32,9 +32,9 @@ except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@adapter(Interface, IDiscussionLayer, Interface, IField, Interface)
|
||||
@implementer(IValidator)
|
||||
class CaptchaValidator(validator.SimpleFieldValidator):
|
||||
adapts(Interface, IDiscussionLayer, Interface, IField, Interface)
|
||||
# Object, Request, Form, Field, Widget,
|
||||
# We adapt the CaptchaValidator class to all form fields (IField)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user