## Script (Python) "archive_delete"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=ids=[], REQUEST=None
##title=
##
# $Id: archive_delete.py 3078 2008-01-31 22:05:54Z henrik $
"""
archive and delte PIN batches
"""

import logging
logger = logging.getLogger('Skins.archive_delete')
member_id = str(context.portal_membership.getAuthenticatedMember())

if ids:
    for id in ids:
        ob = getattr(context, id)
        ob['archiveBatch'](delete=True)
    message = 'portal_status_message=%s archived and deleted!' % ' '.join(ids)
    context.manage_delObjects(ids)
else:
    message = 'portal_status_message=Select at least one batch to archive and delete!'

if REQUEST is not None:
    return REQUEST.RESPONSE.redirect("%s?%s" % (context.absolute_url(), message))

