[Zope] Re: AW: [Zope-CMF] AccessRule doesn't work

Dieter Maurer dieter@handshake.de
Tue, 6 Aug 2002 19:37:48 +0200


Keller Nicolas writes:
Please stay on the list.

 > ... Access Rules ...
 > I've put everything in an external methode now
 > and it works up to the last line, but I don't know how to do the last one.
 > 
 > Here's my function:
 > 
 > def accessIP(self):
 > ...
 >             REQUEST.RESPONSE.redirect(self.login_form(REQUEST))
The documentation say, "RESPONSE.redirect" will not work.
I do not know why (I am not convinced by the explanation).
However, I know that "RESPONSE.redirect" will not abort processing.
It will traverse to the object, render it, and maybe, finally,
redirect. Probably not, what you want.

Are you sure you want to redirect to "self.login_form(REQUEST)"?
The argument to "redirect" must be an (absolute) URL.

 > This gives me a "Resource not found" error.
I expect, the redirect is executed but the return value of
"self.login_form" is not really a valid URL.
You get a "Not found".

 > You mentioned it would also be
 > possible to do it by raising an exception - but this is not totally clear to
 > me.
	raise 'Redirect',location

 "location" is the URL you want redirect to.


Dieter