Add an accessor method for title. As title is part of the interface

IComment for which we <require> zope2.View a permission check will raise
Unauthorized cause we can not assure that the user's userfolder is in 
the acqusition chain of the object (the attribute is a bare unicode object).
It works for methods. im_self is used to get the acquisition wrapped
object.

svn path=/plone.app.discussion/trunk/; revision=29199
This commit is contained in:
Carsten Senger 2009-08-20 02:06:15 +00:00
parent 4da4ab3599
commit e946ef7979
2 changed files with 6 additions and 2 deletions

View File

@ -64,6 +64,10 @@ class Comment(DynamicType, Traversable, RoleManager, Owned, Implicit):
"""The id of the comment, as a string """The id of the comment, as a string
""" """
return self.id return self.id
def getText(self):
'''the text'''
return self.text
def Title(self): def Title(self):
"""The title of the comment """The title of the comment
@ -104,4 +108,4 @@ def notify_content_object(obj, event):
"""Tell the content object when a comment is added """Tell the content object when a comment is added
""" """
content_obj = aq_parent(aq_parent(obj)) content_obj = aq_parent(aq_parent(obj))
content_obj.reindexObject(idxs=('total_comments', 'last_comment_date', 'commentators',)) content_obj.reindexObject(idxs=('total_comments', 'last_comment_date', 'commentators',))

View File

@ -21,7 +21,7 @@
<!-- Comments --> <!-- Comments -->
<class class=".comment.Comment"> <class class=".comment.Comment">
<require interface=".interfaces.IComment" permission="zope2.View" /> <require interface=".interfaces.IComment" permission="zope2.View" />
<require attributes="Title Creator getId" permission="zope2.View" /> <require attributes="Title Creator getId getText" permission="zope2.View" />
</class> </class>
<utility <utility