From 1670338ace21db82a5f705be30aad69e820b05d5 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 14 Jun 2009 08:45:17 +0000 Subject: [PATCH] Add id fall back for Creator if no Username (Title) has been added. svn path=/plone.app.discussion/trunk/; revision=27417 --- plone/app/discussion/TODO.txt | 2 +- plone/app/discussion/browser/comments.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plone/app/discussion/TODO.txt b/plone/app/discussion/TODO.txt index a1c8318..af79d25 100644 --- a/plone/app/discussion/TODO.txt +++ b/plone/app/discussion/TODO.txt @@ -17,7 +17,7 @@ plone.app.discussion to-do [ ] Add i18n translations - [ ] Add id fall back for Creator if no Username (Title) has been added + [X] Add id fall back for Creator if no Username (Title) has been added [ ] Plone reports "unsuccessfully attempted to uncatalog an object" while trying to delete a comment. diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index c339ec8..078d0b2 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -158,7 +158,11 @@ class AddComment(BrowserView): comment.creation_date = comment.modification_date = datetime.now() else: member = portal_membership.getAuthenticatedMember() - comment.creator = member.getProperty('fullname') + fullname = member.getProperty('fullname') + if fullname == '' or None: + comment.creator = member.id + else: + comment.creator = fullname comment.author_username = member.getUserName() comment.author_name = member.getProperty('fullname') comment.author_email = member.getProperty('email')