[Zope] Override a redirection in response

Pablo Ziliani pablo@decode.com.ar
Thu, 21 Feb 2002 15:23:52 -0300


Hello,
I'm trying to "veneer" the ZMI's rename form.
Everything works util an error is rised (i.e. rename a file to an existing
file name); the manage_renameObject() method in CopySupport.py then
redirects to manage_main:

try:    ob._notifyOfCopyTo(self, op=1)
except: raise CopyError, MessageDialog(
        title='Invalid Id',
        message=sys.exc_info()[1],
        action ='manage_main') <- why isn't this
                                  conditioned? (i.e.)
                                  to the existence
                                  of a certain variable,
                                  as in
...
if REQUEST is not None:
    return self.manage_main(self, REQUEST, update_menu=1)
return None

Trying to catch the exception is in vain, the redirect remains.
So, is there anyway to catch this exception or at least to remove the
redirect from the RESPONSE?

This is my code so far:

<dtml-try>
  <dtml-with "REQUEST.resolve_url(path_to_container)">
    <dtml-call "manage_renameObject(ids_item, new_ids_item)"> <- kaput
  </dtml-with>
<dtml-except CopyError> <- doesn't work, redirect remains.
  <dtml-call "errIds.append(ids_item)">
</dtml-try>
...
<dtml-call "RESPONSE.redirect(URL1)"> <- ha, ha, ha ...

Thanks for your help,
Pablo.