[Zope-CMF] Administering CMF discussions

Pieter Claerhout pieter.claerhout@pandora.be
Wed, 16 Jan 2002 21:49:37 +0100


Hi Tres,

I just upgraded to CMF 1.2 beta 2, and I'm trying this again, but without
luck.

I'm just wondering if I did it right or not. Here's what I did:

1. I created the script, and changed "talkback =
context.portal_discussion.getDiscussionFor()" to "talkback =
context.portal_discussion.getDiscussionFor(context)", because otherwise it's
saying that it is missing an argument.

2. In the list of replies, I add a link to each discussion item, which looks
like:
   http://myserver/site/test.html/talkback/1011210891/discussionitem_delete

If I try this out, it gives me the following traceback:

<!--
Traceback (innermost last):
  File E:\ZOPE_P~3\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
  File E:\ZOPE_P~3\lib\python\ZPublisher\Publish.py, line 187, in publish
  File E:\ZOPE_P~3\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: DynamicType)
  File E:\ZOPE_P~3\lib\python\ZPublisher\Publish.py, line 171, in publish
  File E:\ZOPE_P~3\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: discussionitem_delete)
  File E:\ZOPE_P~3\lib\python\ZPublisher\Publish.py, line 112, in
call_object
    (Object: discussionitem_delete)
  File E:\ZOPE_P~3\lib\python\Shared\DC\Scripts\Bindings.py, line 324, in
__call__
    (Object: discussionitem_delete)
  File E:\ZOPE_P~3\lib\python\Shared\DC\Scripts\Bindings.py, line 354, in
_bindAndExec
    (Object: discussionitem_delete)
  File E:\ZOPE_P~3\lib\python\Products\PythonScripts\PythonScript.py, line
336, in _exec
    (Object: discussionitem_delete)
    (Info: ({'script': &lt;PythonScript instance at 01B76648&gt;, 'context':
&lt;DiscussionItem instance at 01C54E20&gt;, 'container': &lt;CMFSite
instance at 01600D70&gt;, 'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 6, in discussionitem_delete
    (Object: DynamicType)
  File E:\ZOPE_P~3\lib\python\OFS\Traversable.py, line 107, in absolute_url
    (Object: DynamicType)
AttributeError: (see above)

Any ideas why I did wrong?

Cheers,


Pieter

-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of Tres Seaver
Sent: Tuesday, January 15, 2002 10:05 PM
To: D.Turpie@open.ac.uk
Cc: Zope-Cmf
Subject: Re: [Zope-CMF] Administering CMF discussions


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


_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
requests