[Zope-CMF] Administering CMF discussions

Tres Seaver tseaver@zope.com
Tue, 15 Jan 2002 16:04:36 -0500


D.Turpie@open.ac.uk wrote:

> Tres
> 
> I have managed to make discussion editable by adding the action to the
> 'DiscussionItem' type object.
> 
> I however am not clear on how or what I need to do to be able to delete
> discussion items.
> 
> You said
> 
> 	"The current discussions UI reflects a policy that discussions are
> 	immutable;  to change the policy, you will need to add a custom skin
> 	to expose the method, 'deleteReply' (found in class,
> 	CMFDefault.DiscussionItem.DiscussionItemContainer).  This method is
> 	protected by the 'Manage portal' permission."
> 
> Could you explain this further or in simpler terms.
> 
> Sorry from a newbie...

You will need to add a skin method, e.g., 'discitem_delete', which

operates on the 'talkback' object of the discussed content, e.g.::

   ## Script (Python) "discitem_delete"
   ## parameters=
   ## title=Delete discussion item
   parent = context.inReplyTo()
   talkback = context.portal_discussion.getDiscussionFor()
   talkback.deleteReply( context.getId() )

   context.REQUEST['RESPONSE'].redirect( parent.absolute_url()
             + '?portal_status_message=Reply+deleted' )


Then create an action for DiscussionItem (like the one you made
for edit) which has 'discitem_delete' as its action.  The
permission which governs 'deleteReply' is 'Manage portal', so
you won't be able to let others besides managers use the action
unless you write it as an ExternalMethod, or give it proxy roles.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com