From 8b9a3e63c9f8dd55f0dac51079598cb7388e5d42 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 24 Aug 2009 18:09:32 +0000 Subject: [PATCH] replace data.has_key() with "key in data". svn path=/plone.app.discussion/trunk/; revision=29342 --- plone/app/discussion/browser/comments.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index e23fa61..0a113c1 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -92,6 +92,7 @@ def cancelButtonActionFactory(request, field): button.klass += " standalone" return button + class CommentForm(extensible.ExtensibleForm, form.Form): ignoreContext = True # don't use context to get widget data @@ -129,7 +130,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): portal_membership = getToolByName(self.context, 'portal_membership') if settings.captcha != 'disabled' and portal_membership.isAnonymousUser(): # Check captcha only if it is not disabled - if data.has_key('captcha'): + if 'captcha' in data: # Check captcha only if there is a value, otherwise # the default "required" validator is sufficient. captcha = CaptchaValidator(self.context, self.request, None, ICaptcha['captcha'], None) @@ -137,22 +138,22 @@ class CommentForm(extensible.ExtensibleForm, form.Form): else: return - if data.has_key('title') and data.has_key('text'): + if 'title' in data and 'text' in data: title = data['title'] text = data['text'] - if data.has_key('author_name'): + if 'author_name' in data: author_name = data['author_name'] else: author_name = u"" - if data.has_key('author_username'): + if 'author_username' in data: author_name = data['author_username'] else: author_username = u"" - if data.has_key('author_email'): + if 'author_email' in data: author_email = data['author_email'] else: author_email = u"" @@ -202,7 +203,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): portal_membership = getToolByName(self.context, 'portal_membership') if settings.captcha != 'disabled' and portal_membership.isAnonymousUser(): # Check captcha only if it is not disabled - if data.has_key('captcha'): + if 'captcha' in data: # Check captcha only if there is a value, otherwise # the default "required" validator is sufficient. captcha = CaptchaValidator(self.context, self.request, None, ICaptcha['captcha'], None) @@ -210,23 +211,23 @@ class CommentForm(extensible.ExtensibleForm, form.Form): else: return - if data.has_key('title') and data.has_key('text') and data.has_key('in_reply_to'): + if 'title' in data and 'text' in data and 'in_reply_to' in data: title = data['title'] text = data['text'] reply_to_comment_id = data['in_reply_to'] - if data.has_key('author_name'): + if 'author_name' in data: author_name = data['author_name'] else: author_name = u"" - if data.has_key('author_username'): + if 'author_username' in data: author_name = data['author_username'] else: author_username = u"" - if data.has_key('author_email'): + if 'author_email' in data: author_email = data['author_email'] else: author_email = u""