diff --git a/CHANGES.txt b/CHANGES.txt index fed8a50..4ea5e54 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) ------------------- diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 767cc31..8a85457 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -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 diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 3d43266..08ae949 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -123,7 +123,7 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable, else: creator = self.creator creator = creator - + # Fetch the content object (the parent of the comment is the # conversation, the parent of the conversation is the content object). content = aq_base(self.__parent__.__parent__) diff --git a/plone/app/discussion/testing.py b/plone/app/discussion/testing.py index 07fc690..076bf82 100644 --- a/plone/app/discussion/testing.py +++ b/plone/app/discussion/testing.py @@ -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, diff --git a/plone/app/discussion/tests/functional_test_comments.txt b/plone/app/discussion/tests/functional_test_comments.txt index cefb046..1421afc 100644 --- a/plone/app/discussion/tests/functional_test_comments.txt +++ b/plone/app/discussion/tests/functional_test_comments.txt @@ -30,13 +30,13 @@ We also keep another testbrowser handy for testing how tiles are rendered if 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 = getToolByName(portal, 'portal_membership', None) + >>> 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 - '...Jim Fulton...says:...' + '...Jim Fult\xc3\xb8rn...says:...' >>> "Comment from Jim" in browser.contents True diff --git a/setup.py b/setup.py index 1aa94d4..963de26 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '1.0b10' +version = '1.0b11' setup(name='plone.app.discussion', version=version,