## Script (Python) "archive"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=ids=[], REQUEST=None
##title=
##
# $Id: archive.py 3077 2008-01-31 22:05:11Z henrik $
"""
FIXME: add docstring.
"""
try:
    from Products.zdb import set_trace
except:
    def set_trace():
        pass

import logging
logger = logging.getLogger('Skins.archive')
member_id = str(context.portal_membership.getAuthenticatedMember())
if ids:
    for id in ids:
        ob = getattr(context, id)
        ob['archiveBatch']()
    message = 'portal_status_message=%s archived!' % ' '.join(ids)
else:
    message = 'portal_status_message=Select at least one batch to archive!'

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