[Zope-dev] __before_publishing_traverse__ calls RESPONSE.redirect(): is there
another way to change the browser URL?
Craeg K Strong
cstrong@arielpartners.com
Mon, 23 Sep 2002 22:59:49 -0400
Hello:
I have defined a __before_publishing__traverse__() method in my Zope product.
Its job is to redirect the URL displayed in the browser to a nice looking
URL, something like
"../myapp/invoices/123"
instead of
"../myapp/execute"
That way all my ZPT forms can call the same method: execute(),
and I don't hardcode any URLs in my ZPTs. The objective is to
encapsulate my resource-to-URL mapping so that it can be changed
independently from the ZPT code.
I don't want to use setVirtualRoot, because I want to change the entire
URL, not just "all but the leaf"
The problem is that __before_publishing_traverse__ is getting called *twice*
for each button press.
*First* it gets called with the "../myapp/execute" URL. This is when I
call RESPONSE.redirect()
*Second* it gets called with the "../myapp/invoices/123" URL
I am trying to understand how Zope works with the HTTP REDIRECT machinery.
Is there a way to make the URL that is actually displayed in the browser
*different* from the Zope method name you are calling, aside from using
RESPONSE.redirect()?
Thanks in advance,
--Craeg Strong
Ariel Partners LLC