## Script (Python) "topic_subject_identifier_edit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=REQUEST, RESPONSE
##title=
##
from Products.PythonScripts.standard import url_quote

new_subject_identifier = REQUEST.new_subject_identifier
subject_identifier = REQUEST.get('subject_identifier', None)

if not subject_identifier is None:
    if new_subject_identifier!=subject_identifier:
        if context.removeSubjectIdentifier(subject_identifier):
            context.addSubjectIdentifier(new_subject_identifier)
        else:
            RESPONSE.redirect(context.absolute_url() + "/topic_subject_identifier_edit_form?warning_message=Unable+to+subject+identifier&source_locator=" + url_quote(subject_identifier))
            return
    
RESPONSE.redirect(context.absolute_url() + "/topic_subject_identifier_edit_form?subject_identifier=" + url_quote(new_subject_identifier))
