## Script (Python) "folder_delete" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=ids=[], REQUEST=None ##title= ## # $Id: folder_delete.py 2013 2007-07-12 16:12:23Z henrik $ """ FIXME: add docstring. """ import logging logger = logging.getLogger('Skins.folder_delete') member_id = str(context.portal_membership.getAuthenticatedMember()) from Products.CMFCore.utils import getToolByName here = context ti = getToolByName(here, 'portal_types').getTypeInfo(here.portal_type) meth_id = ti.queryMethodID('view', 'folder_contents') ret_url = here.absolute_url() + '/' + meth_id if ids: for id in ids: # XXX has to be called from here since the workflow doesn't handle the # deletion yet if context.portal_type == "CoursesFolder": context.courses_catalog.deleteRecord(id) ob = getattr(here, id) from Products.CPSCore.EventServiceTool import getPublicEventService evtool = getPublicEventService(here) evtool.notifyEvent('workflow_delete', ob, {}) here.manage_delObjects(ids) message = 'portal_status_message=psm_item(s)_deleted' else: message = 'portal_status_message=psm_select_at_least_one_document' if REQUEST is not None: return REQUEST.RESPONSE.redirect(ret_url + '?' + message)