## Script (Python) "content_edit_form_remove_association"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=REQUEST, RESPONSE
##title=
##
assocserial = REQUEST.get('activeassoc', None)
anchor = REQUEST.get('anchor', None)
if not assocserial:
    msg = "No associations selected."
else:
    topicmap = context.getTopicMap()
    assoc = topicmap.getAssociationBySerial(assocserial)
    if assoc is None:
        raise AssertionError, "No association with tm_serial %s"%assocserial
    context.removeAssociation(assoc)
    msg = "Association successfully removed."
    
from Products.PythonScripts.standard import url_quote_plus as url_quote

RESPONSE.redirect("%s/%s?portal_status_message=%s%s"%(context.absolute_url(), context.getTypeInfo().getActionById('edit'), url_quote(msg), anchor))

