some code-analysis reclamations fixed.
code-analysis OK up to: T100, S100, S101, C815, C812
This commit is contained in:
parent
100690ccdf
commit
b08852baa0
@ -47,7 +47,7 @@ comment form with the "website" field::
|
||||
from zope import schema
|
||||
|
||||
from zope.annotation import factory
|
||||
from zope.component import adapts
|
||||
from zope.component import adapter
|
||||
from zope.interface import Interface
|
||||
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
|
||||
|
||||
@ -61,9 +61,9 @@ comment form with the "website" field::
|
||||
website = schema.TextLine(title=u"Website", required=False)
|
||||
|
||||
# Persistent class that implements the ICommentExtenderFields interface
|
||||
@adapter(Comment)
|
||||
class CommentExtenderFields(Persistent):
|
||||
interface.implements(ICommentExtenderFields)
|
||||
adapts(Comment)
|
||||
website = u""
|
||||
|
||||
# CommentExtenderFields factory
|
||||
@ -71,9 +71,8 @@ comment form with the "website" field::
|
||||
|
||||
# Extending the comment form with the fields defined in the
|
||||
# ICommentExtenderFields interface.
|
||||
@adapter(Interface, IDefaultBrowserLayer, CommentForm)
|
||||
class CommentExtender(extensible.FormExtender):
|
||||
adapts(Interface, IDefaultBrowserLayer, CommentForm)
|
||||
|
||||
fields = Fields(ICommentExtenderFields)
|
||||
|
||||
def __init__(self, context, request, form):
|
||||
|
@ -13,8 +13,8 @@ from zope.traversing.interfaces import ITraversable
|
||||
from zope.traversing.interfaces import TraversalError
|
||||
|
||||
|
||||
@adapter(Interface, IBrowserRequest)
|
||||
@implementer(ITraversable)
|
||||
@adapter(Interface, IBrowserRequest)
|
||||
class ConversationNamespace(object):
|
||||
"""Allow traversal into a conversation via a ++conversation++name
|
||||
namespace. The name is the name of an adapter from context to
|
||||
|
@ -32,8 +32,8 @@ except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@adapter(Interface, IDiscussionLayer, Interface, IField, Interface)
|
||||
@implementer(IValidator)
|
||||
@adapter(Interface, IDiscussionLayer, Interface, IField, Interface)
|
||||
class CaptchaValidator(validator.SimpleFieldValidator):
|
||||
# Object, Request, Form, Field, Widget,
|
||||
# We adapt the CaptchaValidator class to all form fields (IField)
|
||||
|
@ -77,10 +77,7 @@ def creator(object):
|
||||
@indexer(IComment)
|
||||
def description(object):
|
||||
# Return the first 25 words of the comment text and append ' [...]'
|
||||
text = join(
|
||||
object.getText(targetMimetype='text/plain')
|
||||
.split()[:MAX_DESCRIPTION]
|
||||
)
|
||||
text = join(object.getText(targetMimetype='text/plain').split()[:MAX_DESCRIPTION])
|
||||
if len(object.getText().split()) > 25:
|
||||
text += ' [...]'
|
||||
return text
|
||||
|
@ -324,8 +324,8 @@ else:
|
||||
return conversationAdapterFactory(content)
|
||||
|
||||
|
||||
@adapter(Conversation) # relies on implementation details
|
||||
@implementer(IReplies)
|
||||
@adapter(Conversation) # relies on implementation details
|
||||
class ConversationReplies(object):
|
||||
"""An IReplies adapter for conversations.
|
||||
|
||||
@ -400,8 +400,8 @@ class ConversationReplies(object):
|
||||
return self.conversation._children.get(self.comment_id, LLSet())
|
||||
|
||||
|
||||
@adapter(Comment)
|
||||
@implementer(IReplies)
|
||||
@adapter(Comment)
|
||||
class CommentReplies(ConversationReplies):
|
||||
"""An IReplies adapter for comments.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user