[Zope] Redirecting from Python?

Jonothan Farr jfarr@real.com
Fri, 4 Aug 2000 10:58:02 -0700


Are you doing a dtml-var or dtml-call to call your external method? I believe
you need a dtml-call.
--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998

----- Original Message -----
From: Christopher J. Kucera <ckucera@globalcrossing.com>
To: <zope@zope.org>
Sent: Friday, August 04, 2000 10:49 AM
Subject: [Zope] Redirecting from Python?


> Greetings!
>
> I'm working on a Product, and I'd like to be able to do a RESPONSE.redirect()
> from inside the Python code.  What I had was basically this:
>
> <dtml-if "some number of conditions">
>   View the page . . .
> <dtml-else>
>   <dtml-call "RESPONSE.redirect('blahblahblah')">
> </dtml-if>
>
> This works fine, but rather than having that sitting out in DTML-land,
> I figured I could put the conditions in the Python code and simplify
> the if statement, so all I'd have to do is:
>
> <dtml-if someConditions>
>   View the page . . .
> </dtml-if>
>
> The Python code I was hoping would accomplish this was:
>
> def someConditions(self):
>   if (some number of conditions):
>     return 1
>   else:
>     self.REQUEST.RESPONSE.redirect('blahblahblah')
>
> My problem is that the redirect just doesn't happen.  I've had this
> function return values and the like, so I know it's parsing my conditions
> correctly, and I can even do a "return self.REQUEST.RESPONSE.redirect" and
> have the function returned back into my page, but it won't actually
> redirect.
>
> Any ideas?  Thanks in advance . . .
>
> -CJ
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>