[Zope] (no subject)

Tino Wildenhain tino@wildenhain.de
Sat, 24 May 2003 20:34:49 +0200


John Kipling Lewis wrote:
> Calling a function, which deletes an element of a list, from a hyperlink
> and returning a display page from that function.  The URL in the browser
> address bar shows the the call to the function (and passed variables).
> How do you change the returned URL so that the display page shows the
> changes?

The server does not return URL information. It only returns the content
of what the URL points to. If you click a link in a page, your
browser uses its recorded information of the pages URL, adds to this
the link you click and put it into the address-line, then it connects
to the server and waits for response.

If the server however sends a REDIRECT response, in the header of
the answer is a "location" line which points to the new URL.
The browser often is so kindly to automatically copy this URL
to the address-line and make a new connect.

IF you use this to modify the URL, it can only be modified after
the server has answered, this means the URL in the address-line
while the browser is waiting will contain your variables and stuff.

Until you use POST method for your form or hide the true page
in a frame set, there is nothing you can do against this.

(Otoh - why should you? Ok, having nice URLs is a great idea,
but if you want to do it for "security" - forget it. All whats
sent by the browser is visible for the user)

> We tried RESPONSE.redirect(foo) and that worked except the display page
> didn't show the changes that had been made.  The browser didn't reload the
> page (perhaps assuming it was not changed and used the cached version?)

This is another thing; first you have to mark your page "expired"
when it first appears.
For example you can use:

response.setHeader("Cache-Control", "no-cache")

Which tells browsers and downstream-proxies that the page
is already 1 day outdated.

Done that and it does not help? Say thank you to brain dead
browser manufacturers which set defaults to ignore servers
information about life time of a resource. You can change
this for your browser, but dont expect it to be changed
by every of your users.

Tino Wildenhain

PS: for references, see http://www.faqs.org
under http://www.faqs.org/rfcs/rfc2616.html

> John -
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )