Raising HTTP response codes from PythonMethods
In DTML I can do <dtml-raise Redirect>&dtml-BASE0</dtml-raise> and I'll get redirected to BASE0, since the exception is converted into a HTTP response code. How can I do the same in a PM? I'm trying to get a NotModified header to be returned, aborting the transaction while I'm at it. -- Itamar S.T. itamars@ibm.net
On Mon, 3 Apr 2000, Itamar Shtull-Trauring wrote:
In DTML I can do <dtml-raise Redirect>&dtml-BASE0</dtml-raise>
and I'll get redirected to BASE0, since the exception is converted into a HTTP response code.
How can I do the same in a PM? I'm trying to get a NotModified header to be returned, aborting the transaction while I'm at it.
Never tried this myself, but it seems raise "Redirect", REQUEST["BASE0"] is a point where you may start experimenting... Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Oleg Broytmann wrote:
raise "Redirect", REQUEST["BASE0"]
is a point where you may start experimenting...
Thanks, that helped: I do raise "NotModified", '' and I do get a 304 Not modified response, but I *also* get a Zope error. The correct code is apparently: RESPONSE.setStatus(304) RESPONSE.write('') raise "NotModified", '' -- Itamar S.T. itamars@ibm.net
participants (2)
-
Itamar Shtull-Trauring -
Oleg Broytmann