##parameters=REQUEST, RESPONSE
changed = False
instances = context.getTypeFor(wrap=True)
for topic in instances:
    topic.addTypes(context)
    changed = True
if changed:
    from Products.PythonScripts.standard import url_quote_plus as url_quote
    url = context.absolute_url()
    target = context.getTypeInfo().getActionById('ztmedit')
    msg = url_quote("Updated %d instance%s of %s."%( len(instances)
                                                   , len(instances)>1 and 's' or ''
                                                   , context.title_or_id()
                                                   )
                   )
    RESPONSE.redirect("%s/%s?portal_status_message=%s"%(url, target, msg))
