Added an optional conversationCanonicalAdapterFactory showing how to share comments across all translations with LinguaPlone, by storing and retrieving the conversation from the canonical object.
svn path=/plone.app.discussion/trunk/; revision=33546
This commit is contained in:
parent
9c80b99ead
commit
405ecc1268
@ -4,6 +4,10 @@ Changelog
|
||||
1.0b3 (XXXX-XX-XX)
|
||||
------------------
|
||||
|
||||
* Added an optional conversationCanonicalAdapterFactory showing how to share
|
||||
comments across all translations with LinguaPlone, by storing and retrieving
|
||||
the conversation from the canonical object. [hannosch]
|
||||
|
||||
* Play by the Plone 3.3+ rules and use the INavigationRoot as a base for the moderation view. [hannosch]
|
||||
* Added a commentTitle CSS class to the comment titles. [hannosch]
|
||||
* Update message ids to match their real text. [hannosch]
|
||||
|
@ -341,6 +341,7 @@ class Conversation(Traversable, Persistent, Explicit):
|
||||
for k, v in self._comments.iteritems():
|
||||
yield (k, v.__of__(self),)
|
||||
|
||||
|
||||
@implementer(IConversation)
|
||||
@adapter(IAnnotatable)
|
||||
def conversationAdapterFactory(content):
|
||||
@ -356,6 +357,26 @@ def conversationAdapterFactory(content):
|
||||
conversation = annotions[ANNOTATION_KEY]
|
||||
return conversation.__of__(content)
|
||||
|
||||
|
||||
try:
|
||||
from Products.LinguaPlone.interfaces import ITranslatable
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
@implementer(IConversation)
|
||||
@adapter(IAnnotatable)
|
||||
def conversationCanonicalAdapterFactory(content):
|
||||
"""Adapter factory to fetch the default conversation from annotations.
|
||||
Will create the conversation if it does not exist.
|
||||
|
||||
This adapter will fetch and store all comments on the canonical object,
|
||||
so that comments will be shared across all translations.
|
||||
"""
|
||||
if ITranslatable.providedBy(content):
|
||||
content = content.getCanonical()
|
||||
return conversationAdapterFactory(content)
|
||||
|
||||
|
||||
class ConversationReplies(object):
|
||||
"""An IReplies adapter for conversations.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user