Set fields as class attribute to make captcha formextender work again. This is kind of ugly, the fields should be enirely omitted and not only hidden.
svn path=/plone.app.discussion/trunk/; revision=28370
This commit is contained in:
parent
eadbb55a87
commit
8e9c75a6fc
@ -54,12 +54,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
|
|
||||||
ignoreContext = True # don't use context to get widget data
|
ignoreContext = True # don't use context to get widget data
|
||||||
label = _(u"Add a comment")
|
label = _(u"Add a comment")
|
||||||
|
fields = field.Fields(IComment).omit('portal_type',
|
||||||
@property
|
|
||||||
def fields(self):
|
|
||||||
portal_membership = getToolByName(self.context, 'portal_membership')
|
|
||||||
if portal_membership.isAnonymousUser():
|
|
||||||
return field.Fields(IComment).omit('portal_type',
|
|
||||||
'__parent__',
|
'__parent__',
|
||||||
'__name__',
|
'__name__',
|
||||||
'comment_id',
|
'comment_id',
|
||||||
@ -67,23 +62,16 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
'creator',
|
'creator',
|
||||||
'creation_date',
|
'creation_date',
|
||||||
'modification_date',
|
'modification_date',
|
||||||
'author_username',)
|
'author_username')
|
||||||
else:
|
|
||||||
return field.Fields(IComment).omit('portal_type',
|
|
||||||
'__parent__',
|
|
||||||
'__name__',
|
|
||||||
'comment_id',
|
|
||||||
'mime_type',
|
|
||||||
'creator',
|
|
||||||
'creation_date',
|
|
||||||
'modification_date',
|
|
||||||
'author_username',
|
|
||||||
'author_name',
|
|
||||||
'author_email',)
|
|
||||||
|
|
||||||
def updateWidgets(self):
|
def updateWidgets(self):
|
||||||
super(CommentForm, self).updateWidgets()
|
super(CommentForm, self).updateWidgets()
|
||||||
self.widgets['in_reply_to'].mode = interfaces.HIDDEN_MODE
|
self.widgets['in_reply_to'].mode = interfaces.HIDDEN_MODE
|
||||||
|
portal_membership = getToolByName(self.context, 'portal_membership')
|
||||||
|
if not portal_membership.isAnonymousUser():
|
||||||
|
# XXX: This is ugly. The fields should be omitted, not hidden.
|
||||||
|
self.widgets['author_name'].mode = interfaces.HIDDEN_MODE
|
||||||
|
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
||||||
|
|
||||||
@button.buttonAndHandler(_(u"Comment"))
|
@button.buttonAndHandler(_(u"Comment"))
|
||||||
def handleComment(self, action):
|
def handleComment(self, action):
|
||||||
|
Loading…
Reference in New Issue
Block a user