[CMF-checkins] CVS: CMF - DiscussionItem.py:1.12
andrew@digicool.com
andrew@digicool.com
Fri, 1 Jun 2001 14:42:05 -0400 (EDT)
Update of /cvs-repository/CMF/CMFDefault
In directory korak.digicool.com:/tmp/cvs-serv27084
Modified Files:
DiscussionItem.py
Log Message:
*Added method manage_beforeDelete to the DiscussionItemContainer
class to fix tracker #269 and allowing for proper handling for
manage_beforeDelete should individual discussion items be allowed
for deletion at a later date.
--- Updated File DiscussionItem.py in package CMF --
--- DiscussionItem.py 2001/05/25 17:43:37 1.11
+++ DiscussionItem.py 2001/06/01 18:42:04 1.12
@@ -85,12 +85,13 @@
import Globals
from Globals import HTMLFile, Persistent, PersistentMapping
-from Acquisition import Implicit
+from Acquisition import Implicit, aq_base
from Discussions import DiscussionResponse
from Document import Document
from DublinCore import DefaultDublinCoreImpl
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName, _checkPermission
+from Products.CMFCore.PortalContent import PortalContent
import urllib, string
def addDiscussionItem(self, id, title, description, text_format, text,
@@ -256,6 +257,12 @@
except:
REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, ''))
+ def manage_beforeDelete(self, item, container):
+ "Remove the contained items from the catalog."
+ if aq_base(container) is not aq_base(self):
+ for obj in self.getReplies():
+ obj.manage_beforeDelete(item, container)
+
def objectIds(self, spec=None):
"""
return a list of ids of DiscussionItems in
@@ -282,7 +289,7 @@
"""
return self._container.values()
- def createReply(self, title, text, REQUEST, RESPONSE):
+ def createReply(self, title, text, REQUEST={}, RESPONSE=None):
"""
Create a reply in the proper place
"""
@@ -304,7 +311,8 @@
self._container[`id`] = item
- RESPONSE.redirect( self.aq_inner.aq_parent.absolute_url() + '/view' )
+ if RESPONSE is not None:
+ RESPONSE.redirect( self.aq_inner.aq_parent.absolute_url() + '/view' )
def hasReplies(self):
"""