merge r34694-r34695 from the jarn-1.0b3 branch.

Fix unicode error when non-ASCII characters are typed into the name field of a comment by anonymous users. 
We are indexing the member.id only now instead of the full member name or what anonymous users typed into the name field.

svn path=/plone.app.discussion/trunk/; revision=34932
This commit is contained in:
Timo Stollenwerk 2010-03-16 13:06:08 +00:00
parent 6e226be248
commit 819b66e149
3 changed files with 11 additions and 10 deletions

View File

@ -4,6 +4,10 @@ Changelog
1.0b4 (unreleased) 1.0b4 (unreleased)
------------------ ------------------
* Fix unicode error when non-ASCII characters are typed into the name field of a
comment by anonymous users.
[regebro]
* New feature: As a moderator, I am notified when new comments require my * New feature: As a moderator, I am notified when new comments require my
attention. attention.
[timo] [timo]
@ -17,6 +21,7 @@ Changelog
* Added greek translation. * Added greek translation.
[ggozad] [ggozad]
1.0b3 (2010-01-28) 1.0b3 (2010-01-28)
------------------ ------------------

View File

@ -74,8 +74,8 @@
<span tal:condition="not: has_author_link" <span tal:condition="not: has_author_link"
tal:replace="reply/Creator" /> tal:replace="reply/Creator" />
</tal:name> </tal:name>
<tal:name i18n:translate="label_anonymous_user" <tal:name condition="python:reply.Creator() in ('Anonymous User', '', None)"
condition="python:reply.Creator() in ('Anonymous User', '', None)">Anonymous User</tal:name> tal:content="reply/author_name">Anonymous User</tal:name>
<tal:at i18n:translate="label_commented_at">at</tal:at> <tal:at i18n:translate="label_commented_at">at</tal:at>
<span tal:replace="python:view.format_time(reply.modification_date)">8/23/2001 12:40:44 PM</span> <span tal:replace="python:view.format_time(reply.modification_date)">8/23/2001 12:40:44 PM</span>
</div> </div>

View File

@ -142,22 +142,18 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
portal_membership = getToolByName(self.context, 'portal_membership') portal_membership = getToolByName(self.context, 'portal_membership')
if portal_membership.isAnonymousUser(): if portal_membership.isAnonymousUser():
comment.creator = author_name comment.creator = None
comment.author_name = author_name comment.author_name = author_name
comment.author_email = author_email comment.author_email = author_email
comment.author_notification = author_notification #comment.author_notification = author_notification
comment.creation_date = comment.modification_date = datetime.now() comment.creation_date = comment.modification_date = datetime.now()
else: else:
member = portal_membership.getAuthenticatedMember() member = portal_membership.getAuthenticatedMember()
fullname = member.getProperty('fullname')
if fullname == '' or None:
comment.creator = member.id comment.creator = member.id
else:
comment.creator = fullname
comment.author_username = member.getUserName() comment.author_username = member.getUserName()
comment.author_name = member.getProperty('fullname') comment.author_name = member.getProperty('fullname')
comment.author_email = member.getProperty('email') comment.author_email = member.getProperty('email')
comment.author_notification = comment.author_notification #comment.author_notification = comment.author_notification
comment.creation_date = comment.modification_date = datetime.now() comment.creation_date = comment.modification_date = datetime.now()
# Check if the added comment is a reply to an existing comment # Check if the added comment is a reply to an existing comment