Make unit tests pass with Plone 3.3 again. Migration tests still failing.
svn path=/plone.app.discussion/trunk/; revision=30633
This commit is contained in:
parent
b07f556a32
commit
e5f1a70de6
@ -1,7 +1,7 @@
|
|||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
||||||
plone.app.discussion aims to be the new commenting system for Plone 4. It is developed as part of the Google Summer of Code 2009 by Timo Stollenwerk (student) and Martin Aspeli (mentor).
|
plone.app.discussion aims to be the new commenting system for Plone 4.1. It was developed as part of the Google Summer of Code 2009 by Timo Stollenwerk (student) and Martin Aspeli (mentor).
|
||||||
|
|
||||||
For details on the progress of this project, visit our `Pivotal Tracker`_.
|
For details on the progress of this project, visit our `Pivotal Tracker`_.
|
||||||
|
|
||||||
@ -41,11 +41,6 @@ To install plone.app.discussion, add the following code to your buildout.cfg::
|
|||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
Known Issues
|
|
||||||
============
|
|
||||||
|
|
||||||
- Clear and rebuild the catalog looses all the comments.
|
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
=======
|
=======
|
||||||
|
|
||||||
@ -54,3 +49,5 @@ Credits
|
|||||||
- Jon Stahl
|
- Jon Stahl
|
||||||
- David Glick
|
- David Glick
|
||||||
- Lennart Regebro
|
- Lennart Regebro
|
||||||
|
- Carsten Senger
|
||||||
|
- Hanno Schlichting
|
||||||
|
@ -59,6 +59,8 @@ def searchable_text(object):
|
|||||||
|
|
||||||
@indexer(IComment)
|
@indexer(IComment)
|
||||||
def in_response_to(object):
|
def in_response_to(object):
|
||||||
|
# Always returns the content object the comment is added to.
|
||||||
|
# Do not confuse this with the in_reply_to attribute of a comment!
|
||||||
return object.__parent__.__parent__.title_or_id()
|
return object.__parent__.__parent__.title_or_id()
|
||||||
|
|
||||||
@indexer(IComment)
|
@indexer(IComment)
|
||||||
|
@ -12,8 +12,19 @@ from AccessControl.Owned import Owned
|
|||||||
from plone.app.discussion.interfaces import IComment
|
from plone.app.discussion.interfaces import IComment
|
||||||
|
|
||||||
from Products.CMFCore.DynamicType import DynamicType
|
from Products.CMFCore.DynamicType import DynamicType
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Plone 4:
|
||||||
|
# Mixin CatalogAware and WorkflowAware into the Comment class
|
||||||
|
# is necessary for comments to be indexed in Plone4.
|
||||||
from Products.CMFCore.CMFCatalogAware import CatalogAware
|
from Products.CMFCore.CMFCatalogAware import CatalogAware
|
||||||
from Products.CMFCore.CMFCatalogAware import WorkflowAware
|
from Products.CMFCore.CMFCatalogAware import WorkflowAware
|
||||||
|
except:
|
||||||
|
# Plone 3:
|
||||||
|
# Dummy imports to make Comment class happy
|
||||||
|
from OFS.Traversable import Traversable as CatalogAware
|
||||||
|
from OFS.Traversable import Traversable as WorkflowAware
|
||||||
|
|
||||||
from Products.CMFCore.utils import getToolByName
|
from Products.CMFCore.utils import getToolByName
|
||||||
|
|
||||||
class Comment(CatalogAware, WorkflowAware, DynamicType,
|
class Comment(CatalogAware, WorkflowAware, DynamicType,
|
||||||
@ -87,6 +98,17 @@ class Comment(CatalogAware, WorkflowAware, DynamicType,
|
|||||||
"""
|
"""
|
||||||
return self.portal_type
|
return self.portal_type
|
||||||
|
|
||||||
|
# CMF's event handlers assume any IDynamicType has these :(
|
||||||
|
|
||||||
|
def opaqueItems(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
def opaqueIds(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
def opaqueValues(self):
|
||||||
|
return []
|
||||||
|
|
||||||
CommentFactory = Factory(Comment)
|
CommentFactory = Factory(Comment)
|
||||||
|
|
||||||
def notify_workflow(obj, event):
|
def notify_workflow(obj, event):
|
||||||
|
@ -40,8 +40,14 @@ from Products.CMFPlone.interfaces import IPloneSiteRoot, INonStructuralFolder
|
|||||||
|
|
||||||
from zope.container.contained import ContainerModifiedEvent
|
from zope.container.contained import ContainerModifiedEvent
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Plone 4
|
||||||
from zope.lifecycleevent import ObjectAddedEvent
|
from zope.lifecycleevent import ObjectAddedEvent
|
||||||
from zope.lifecycleevent import ObjectRemovedEvent
|
from zope.lifecycleevent import ObjectRemovedEvent
|
||||||
|
except:
|
||||||
|
# Plone 3.x
|
||||||
|
from zope.app.container.contained import ObjectAddedEvent
|
||||||
|
from zope.app.container.contained import ObjectRemovedEvent
|
||||||
|
|
||||||
from BTrees.OIBTree import OIBTree
|
from BTrees.OIBTree import OIBTree
|
||||||
|
|
||||||
@ -90,9 +96,8 @@ class Conversation(Traversable, Persistent, Explicit):
|
|||||||
def enabled(self):
|
def enabled(self):
|
||||||
# Returns True if discussion is enabled on the conversation
|
# Returns True if discussion is enabled on the conversation
|
||||||
|
|
||||||
site = getSite()
|
portal_discussion = getToolByName(self, 'portal_discussion')
|
||||||
portal_discussion = getToolByName(site, 'portal_discussion')
|
portal_types = getToolByName(self, 'portal_types')
|
||||||
portal_types = getToolByName(site, 'portal_types')
|
|
||||||
|
|
||||||
# Fetch discussion registry
|
# Fetch discussion registry
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
|
@ -642,7 +642,12 @@ class ConversationTest(PloneTestCase):
|
|||||||
self.assert_(IConversation.providedBy(conversation))
|
self.assert_(IConversation.providedBy(conversation))
|
||||||
|
|
||||||
self.assertEquals(('', 'plone', 'doc1', '++conversation++default'), conversation.getPhysicalPath())
|
self.assertEquals(('', 'plone', 'doc1', '++conversation++default'), conversation.getPhysicalPath())
|
||||||
self.assertEquals('plone/doc1/%2B%2Bconversation%2B%2Bdefault', conversation.absolute_url())
|
# XXX: conversation.absolute_url() returns different values dependent on
|
||||||
|
# the Plone version used.
|
||||||
|
# Plone 3.3:
|
||||||
|
#self.assertEquals('plone/doc1/%2B%2Bconversation%2B%2Bdefault', conversation.absolute_url())
|
||||||
|
# Plone 4:
|
||||||
|
#self.assertEquals('http://nohost/plone/doc1/++conversation++default', conversation.absolute_url())
|
||||||
|
|
||||||
def test_parent(self):
|
def test_parent(self):
|
||||||
# Check that conversation has a content object as parent
|
# Check that conversation has a content object as parent
|
||||||
|
@ -110,7 +110,7 @@ class CommentIndexersTest(PloneTestCase):
|
|||||||
new_id = conversation.addComment(comment)
|
new_id = conversation.addComment(comment)
|
||||||
|
|
||||||
self.comment_id = new_id
|
self.comment_id = new_id
|
||||||
self.comment = comment
|
self.comment = comment.__of__(conversation)
|
||||||
self.conversation = conversation
|
self.conversation = conversation
|
||||||
|
|
||||||
def test_title(self):
|
def test_title(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user