diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index bd7d08b..a573ed2 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -11,7 +11,9 @@ from AccessControl.Owned import Owned from plone.app.discussion.interfaces import IComment -class Comment(Explicit, Traversable, RoleManager, Owned): +from Products.CMFCore.DynamicType import DynamicType + +class Comment(DynamicType, Traversable, RoleManager, Owned, Explicit): """A comment. This object attempts to be as lightweight as possible. We implement a @@ -71,5 +73,16 @@ class Comment(Explicit, Traversable, RoleManager, Owned): """The name of the person who wrote the comment """ return self.creator + + # CMF's event handlers assume any IDynamicType has these :( + + def opaqueItems(self): + return [] + + def opaqueIds(self): + return [] + + def opaqueValues(self): + return [] CommentFactory = Factory(Comment) \ No newline at end of file diff --git a/plone/app/discussion/profiles/default/types.xml b/plone/app/discussion/profiles/default/types.xml new file mode 100644 index 0000000..4ecc628 --- /dev/null +++ b/plone/app/discussion/profiles/default/types.xml @@ -0,0 +1,4 @@ + + + + diff --git a/plone/app/discussion/profiles/default/types/Discussion_Item.xml b/plone/app/discussion/profiles/default/types/Discussion_Item.xml new file mode 100644 index 0000000..ac15877 --- /dev/null +++ b/plone/app/discussion/profiles/default/types/Discussion_Item.xml @@ -0,0 +1,21 @@ + + + Comment + Comments added to a content item. + discussionitem_icon.gif + Discussion Item + + plone.Comment + + False + True + + True + + + + + + diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index 2374c93..254ab11 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -63,7 +63,13 @@ class CommentTest(PloneTestCase): def test_fti(self): # test that we can look up an FTI for Discussion Item - pass + + self.assert_("Discussion Item" in self.portal.portal_types.objectIds()) + + comment1 = createObject('plone.Comment') + + fti = self.portal.portal_types.getTypeInfo(comment1) + self.assertEquals('Discussion Item', fti.getTypeInfo(comment1).getId()) class RepliesTest(PloneTestCase):