[Zope] redirect in python script ... raise error?
Flynt
rhess@bic.ch
Sun, 17 Jun 2001 22:14:35 +0200
Tom Deprez wrote:
>
> Hi all,
>
> I'm trying to show a html page after I performed an action all this in a
> python script.
>
> I'm trying to redirect a page, but unfortunately, this doesn't work. I've
> the following script
>
> context.sql_methods.products_delete(aID=context.REQUEST['aID'])
> url=context.REQUEST.URL1
> raise 'Redirect', url
>
> This will give me an sql error. (but the sql_method is correct).
> If I remove the redirect rule, then everything works like it should exept
> that I get my confirmation page
>
> Is there a way to another way to a redirect? Otherwise I'm forced to go to
> DTML-Methods :-(
>
> Thanks in advance,
>
> Tom.
Hi Tom
Just a thought, unmotivated and untested: You should be able to access
the *RESPONSE* object through the *REQUEST* object (...
REQUEST.RESPONSE...) and so, maybe you can go through that ?
Let's say, something like (instead of *raise 'Redirect', url*):
context.RESPONSE.redirect(URL1, lock=0)
or:
context.REQUEST.RESPONSE.redirect(URL1, lock=0)
--- Flynt