diff --git a/plone/app/discussion/viewlets/comments.pt b/plone/app/discussion/browser/comments.pt similarity index 100% rename from plone/app/discussion/viewlets/comments.pt rename to plone/app/discussion/browser/comments.pt diff --git a/plone/app/discussion/viewlets/comments.py b/plone/app/discussion/browser/comments.py similarity index 100% rename from plone/app/discussion/viewlets/comments.py rename to plone/app/discussion/browser/comments.py diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index 0a55cb2..56a10e2 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -2,6 +2,20 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" i18n_domain="plone.app.discussion"> + + + + + diff --git a/plone/app/discussion/browser/traversal.py b/plone/app/discussion/browser/traversal.py index ae3a38c..930a6d0 100644 --- a/plone/app/discussion/browser/traversal.py +++ b/plone/app/discussion/browser/traversal.py @@ -3,3 +3,28 @@ IDiscussion container for the context, from which traversal will continue into an actual comment object. """ +from zope.interface import Interface, implements +from zope.component import adapts + +from zope.traversing.interfaces import ITraversable, TraversalError +from zope.publisher.interfaces.browser import IBrowserRequest + +from plone.app.discussion.interfaces import IConversation + +class ConversationNamespace(object): + """Allow traversal into a conversation + """ + implements(ITraversable) + adapts(Interface, IBrowserRequest) + + def __init__(self, context, request=None): + self.context = context + self.request = request + + def traverse(self, name, ignore): + + conversation = IConversation(self.context, None) + if conversation is None: + raise TraversalError('++comment++') + + return conversation.__of__(self.context) diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index b9fee18..931a3f7 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -5,7 +5,6 @@ - count of comments; key is removed when count reaches 0 diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index a1053c9..9c98a23 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -158,3 +158,7 @@ class ICommentingTool(Interface): def searchResults(REQUEST=None, **kw): """Perform a search over all indexed comments. """ + +class IDiscussionLayer(Interface): + """Request marker installed via browserlayer.xml. + """ \ No newline at end of file diff --git a/plone/app/discussion/overrides.zcml b/plone/app/discussion/overrides.zcml deleted file mode 100644 index f556b83..0000000 --- a/plone/app/discussion/overrides.zcml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/plone/app/discussion/profiles/default/browserlayer.xml b/plone/app/discussion/profiles/default/browserlayer.xml new file mode 100644 index 0000000..c64858b --- /dev/null +++ b/plone/app/discussion/profiles/default/browserlayer.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index aed3445..bd5e905 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -34,6 +34,13 @@ class CommentTest(PloneTestCase): def test_traversal(self): # make sure comments are traversable, have an id, absolute_url and physical path + + # XXX - traversal doesn't work without a name? + conversation = self.portal.doc1.restrictedTraverse('++comment++1') + self.assert_(IConversation.providedBy(conversation)) + + # TODO: Test adding comments, traversing to them + pass def test_workflow(self): diff --git a/plone/app/discussion/tests/test_conversation.py b/plone/app/discussion/tests/test_conversation.py index 3e13518..a3ba04f 100644 --- a/plone/app/discussion/tests/test_conversation.py +++ b/plone/app/discussion/tests/test_conversation.py @@ -96,7 +96,7 @@ class ConversationTest(PloneTestCase): pass def test_get_comments_batched(self): - pass + pass def test_get_threads(self): pass diff --git a/plone/app/discussion/viewlets/__init__.py b/plone/app/discussion/viewlets/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/plone/app/discussion/viewlets/configure.zcml b/plone/app/discussion/viewlets/configure.zcml deleted file mode 100644 index 9541b1a..0000000 --- a/plone/app/discussion/viewlets/configure.zcml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/plone/app/discussion/viewlets/overrides.zcml b/plone/app/discussion/viewlets/overrides.zcml deleted file mode 100644 index aa7670f..0000000 --- a/plone/app/discussion/viewlets/overrides.zcml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file