[Zope-CMF] Re: portal discussion and folder like object

Joseph Kocherhans jkocherhans at mac.com
Fri Apr 23 15:27:45 EDT 2004

Sylvain Thénault wrote:

> Hello,
> I've a problemn trying to allow discussion on folder like objects. The
> problem is that discussion items may not be attached to the correct
> folder since the folder may acquire its 'talkback' attribute.
> I've filled a bug to the collector (http://collector.zope.org/CMF/119)
> and tried to wrote a patch but my patch seems to break the discussion
> mecanism in another point when it tries to reconstruct thread.
> Any idea on this ?

I think I've got a solution. The problem with the thread error was 
caused by using aq_explicit in your patch. getDiscussionFor() is called 
on all of the child discussion items. Without the aquisition wrapper, 
nested DiscussionItems can't get their parent talkbacks, so a new 
DiscussionContainer was being created for nested DiscussionItems.

My solution seems pretty hackish to me (testing for portal_type), but 
I'm not sure how else to do it. Any ideas on how this might be done 
better? If not, I'll submit a patch to the open collector issue.

One thing that confuses me though is that _createDiscussionFor() creates 
talkbacks just fine without using aq_base or aq_explicit. I would think 
that 'talkback' would be acquired and assigned a different value. I've 
tested this with several nested folder like objects and it doesn't 
behave that way. Maybe I'm just misunderstanding acquisition here. Does 
it work differently when assigning and getting values?

def getDiscussionFor(self, content):
         Return the talkback for content, creating it if need be.
     if not self.isDiscussionAllowedFor( content ):
         raise DiscussionNotAllowed

     if (content.portal_type == 'Discussion Item' or
         hasattr( content.aq_base, 'talkback' )):
         talkback = content.talkback
         talkback = self._createDiscussionFor( content )
     return talkback


P.S. Sometimes this causes a glitch with the navigation portlet in plone 
2.0-final where sibling items will show up twice in the portlet. I 
haven't narrowed down exactly when and why it happens though.

More information about the Zope-CMF mailing list