hardcoded fti_title, don't query typestool for Type()

all tests succeed

svn path=/plone.app.discussion/trunk/; revision=35290
This commit is contained in:
Florian Friesdorf 2010-03-18 14:42:52 +00:00
parent f41c55cc8c
commit 5beebe42fa
2 changed files with 5 additions and 4 deletions

View File

@ -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 :(

View File

@ -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__)
return unittest.defaultTestLoader.loadTestsFromName(__name__)