[Zope] Redirecting from Python?

Christopher J. Kucera ckucera@globalcrossing.com
Fri, 04 Aug 2000 12:49:52 -0500


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