Add FTI for Discussion Item and test
svn path=/plone.app.discussion/trunk/; revision=27068
This commit is contained in:
parent
e296058c37
commit
8c3c4bdfa0
@ -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
|
||||
@ -72,4 +74,15 @@ class Comment(Explicit, Traversable, RoleManager, Owned):
|
||||
"""
|
||||
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)
|
4
plone/app/discussion/profiles/default/types.xml
Normal file
4
plone/app/discussion/profiles/default/types.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<object name="portal_types" meta_type="CMF Types Tool">
|
||||
<object name="Discussion Item" meta_type="Factory-based Type Information"/>
|
||||
</object>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<object name="Discussion Item" meta_type="Factory-based Type Information"
|
||||
i18n:domain="plone.app.discussion" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
|
||||
<property name="title" i18n:translate="">Comment</property>
|
||||
<property name="description" i18n:translate="">Comments added to a content item.</property>
|
||||
<property name="content_icon">discussionitem_icon.gif</property>
|
||||
<property name="content_meta_type">Discussion Item</property>
|
||||
<property name="product"></property>
|
||||
<property name="factory">plone.Comment</property>
|
||||
<property name="immediate_view"></property>
|
||||
<property name="global_allow">False</property>
|
||||
<property name="filter_content_types">True</property>
|
||||
<property name="allowed_content_types"/>
|
||||
<property name="allow_discussion">True</property>
|
||||
<alias from="(Default)" to="@@view"/>
|
||||
<alias from="view" to="@@view"/>
|
||||
<action title="View" action_id="view" category="object" condition_expr=""
|
||||
url_expr="string:${object_url}/@@view" visible="True">
|
||||
<permission value="View"/>
|
||||
</action>
|
||||
</object>
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user