Fixed handling of non-ascii member data, like fullname and email.
svn path=/plone.app.discussion/trunk/; revision=40789
This commit is contained in:
parent
54bbb08c62
commit
aa8a1ea934
@ -1,6 +1,12 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.0b11 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Fixed handling of non-ascii member data, like fullname and email.
|
||||
[hannosch]
|
||||
|
||||
1.0b10 (2010-10-15)
|
||||
-------------------
|
||||
|
||||
|
@ -172,6 +172,11 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
fullname = member.getProperty('fullname')
|
||||
if not fullname or fullname == '':
|
||||
fullname = member.getUserName()
|
||||
# memberdata is stored as utf-8 encoded strings
|
||||
elif isinstance(fullname, str):
|
||||
fullname = unicode(fullname, 'utf-8')
|
||||
if email and isinstance(email, str):
|
||||
email = unicode(email, 'utf-8')
|
||||
comment.creator = fullname
|
||||
comment.author_username = username
|
||||
comment.author_name = fullname
|
||||
|
@ -49,7 +49,7 @@ class PloneAppDiscussion(PloneSandboxLayer):
|
||||
)
|
||||
mtool = getToolByName(portal, 'portal_membership', None)
|
||||
mtool.addMember('jim', 'Jim', ['Member'], [])
|
||||
mtool.getMemberById('jim').setMemberProperties({"fullname": 'Jim Fulton'})
|
||||
mtool.getMemberById('jim').setMemberProperties({"fullname": 'Jim Fult\xc3\xb8rn'})
|
||||
|
||||
acl_users.userFolderAddUser(
|
||||
self.MANAGER_USER_NAME,
|
||||
|
@ -31,12 +31,12 @@ you're not logged in::
|
||||
|
||||
>>> unprivileged_browser = Browser(app)
|
||||
|
||||
Add a test user
|
||||
Make sure we have a test user from the layer and it uses fancy characters:
|
||||
|
||||
>>> from Products.CMFCore.utils import getToolByName
|
||||
>>> mtool = getToolByName(portal, 'portal_membership', None)
|
||||
>>> mtool.addMember('jim', 'Jim', ['Member'], [])
|
||||
>>> mtool.getMemberById('jim').setMemberProperties({"fullname": 'Jim Fulton'})
|
||||
>>> mtool.getMemberById('jim').getProperty('fullname')
|
||||
'Jim Fult\xc3\xb8rn'
|
||||
|
||||
Create a public page with comments allowed.
|
||||
|
||||
@ -118,7 +118,7 @@ Post a comment as user jim.
|
||||
Check if the comment has been added properly.
|
||||
|
||||
>>> browser.contents
|
||||
'...<a href="http://nohost/plone/author/jim">Jim Fulton</a>...says:...'
|
||||
'...<a href="http://nohost/plone/author/jim">Jim Fult\xc3\xb8rn</a>...says:...'
|
||||
|
||||
>>> "Comment from Jim" in browser.contents
|
||||
True
|
||||
|
Loading…
Reference in New Issue
Block a user