From 5beebe42fad25ff77d389fd92f8ba5b4561381b3 Mon Sep 17 00:00:00 2001 From: Florian Friesdorf Date: Thu, 18 Mar 2010 14:42:52 +0000 Subject: [PATCH] hardcoded fti_title, don't query typestool for Type() all tests succeed svn path=/plone.app.discussion/trunk/; revision=35290 --- plone/app/discussion/comment.py | 5 +++-- plone/app/discussion/tests/test_comment.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 827d1dd..13f360a 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -54,6 +54,8 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable, implements(IComment) meta_type = portal_type = 'Discussion Item' + # This needs to be kept in sync with types/Discussion_Item.xml title + fti_title = 'Comment' __parent__ = None @@ -113,8 +115,7 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable, def Type(self): """The Discussion Item content type """ - ptypes = getToolByName(self, 'portal_types') - return ptypes[self.portal_type].title + return self.fti_title # CMF's event handlers assume any IDynamicType has these :( diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index 2759894..e096cc6 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -45,7 +45,7 @@ class CommentTest(PloneTestCase): def test_type(self): comment1 = createObject('plone.Comment') - self.assertEquals(comment1.Type(), 'Discussion Item') + self.assertEquals(comment1.Type(), 'Comment') def test_traversal(self): # make sure comments are traversable, have an id, absolute_url and physical path @@ -251,4 +251,4 @@ class RepliesTest(PloneTestCase): self.assertEquals('http://nohost/plone/doc1/++conversation++default/' + str(new_re_re_re_id), re_re_re_comment.absolute_url()) def test_suite(): - return unittest.defaultTestLoader.loadTestsFromName(__name__) \ No newline at end of file + return unittest.defaultTestLoader.loadTestsFromName(__name__)