URL Redirection problems...
Hi! I'm facing a problem concerning URL redirection inside Zope: Suppose a try to make a redirection to a DTML document using it's relative path instead of the absolute one: DTML >> <dtml-call expr="RESPONSE.redirect('/abc/xpto?a=1&b=2&c=3')"> Python >> container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3") So far so good... The redirection process goes on apparently well. But if I try to reach the variables I passed in the query string (e.g., REQUEST["a"]), kaput... what a surprise... they don't exist in the REQUEST object as I expected. Apparently the variables are not stored in the REQUEST object. Now the good thing is that the query string is not lost since its stored in a special variable called QUERY_STRING. So if I execute: <dtml-var expr="REQUEST['QUERY_STRING']"> I should get: "a=1&b=2&c=3" I can always parse the string and get the values for each variable, but is there any logical explanation for this? Thanks in advance, Vitor Varalonga
Vitor Varalonga <vpedrosa@ciberbit.pt> wrote:
Python >> container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3")
Strictly speaking this is not correct. You should use container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3") Maybe your browser is very standards compliant ? But somehow I doubt this is it. What browser do you use ? What Zope version ? What's in REQUEST.form ? Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 10 http://nuxeo.com mailto:fg@nuxeo.com
Florent Guillaume wrote:
Strictly speaking this is not correct. You should use
container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3")
Hum... I though about it to... You mean I have to encode the URL. I tried it to and it didn't work out either.
Maybe your browser is very standards compliant ?
But somehow I doubt this is it. What browser do you use ? What Zope version ? What's in REQUEST.form ?
The browser I'm using is Internet Explorer 6.00.2462.0000. Concerning Zope, it must be version 2.5.0b2 since the install file was Zope-2.5.0b2-win32-x86.exe. As I mentioned in my original message, variables a, b and c are not stored in the REQUEST.form object, but I still can reach them through the property QUERY_STRING. Just a strange particularity: if I try to redirect instead to the absolute path of my destination URL, the variables passed through the query string are stored correctly in the REQUEST.form object, as in: container.REQUEST.RESPONSE.redirect("http://www.dummy.pt/abc/xpto?a=1&b=2&c=3") kind regards, Vitor Varalonga
Hmmm Sorry I hadn't paid attention to this. You must always redirect to a full URL, otherwise it's illegal HTTP. Florent On Fri, 2001-12-14 at 11:22, Vitor Varalonga wrote:
Florent Guillaume wrote:
Strictly speaking this is not correct. You should use
container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3")
Hum... I though about it to... You mean I have to encode the URL. I tried it to and it didn't work out either.
Maybe your browser is very standards compliant ?
But somehow I doubt this is it. What browser do you use ? What Zope version ? What's in REQUEST.form ?
The browser I'm using is Internet Explorer 6.00.2462.0000. Concerning Zope, it must be version 2.5.0b2 since the install file was Zope-2.5.0b2-win32-x86.exe. As I mentioned in my original message, variables a, b and c are not stored in the REQUEST.form object, but I still can reach them through the property QUERY_STRING. Just a strange particularity: if I try to redirect instead to the absolute path of my destination URL, the variables passed through the query string are stored correctly in the REQUEST.form object, as in:
container.REQUEST.RESPONSE.redirect("http://www.dummy.pt/abc/xpto?a=1&b=2&c=3")
kind regards,
Vitor Varalonga
-- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 10 http://nuxeo.com mailto:fg@nuxeo.com
Florent Guillaume writes:
Vitor Varalonga <vpedrosa@ciberbit.pt> wrote:
Python >> container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3")
Strictly speaking this is not correct. You should use
container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3") I do not think that this is necessary or even allowed.
Inside HTML documents, you need to use "&" for "&" but here, you are not inside the SGML/HTML/XML world. You are in the HTTP worlds were "&" is the query string separator, not "&" Dieter
container.REQUEST.RESPONSE.redirect("/abc/xpto?a=1&b=2&c=3") I do not think that this is necessary or even allowed.
Inside HTML documents, you need to use "&" for "&" but here, you are not inside the SGML/HTML/XML world. You are in the HTTP worlds were "&" is the query string separator, not "&"
You're right, a Redirect is in pure HTTP-land and no & is required or allowed. Sorry for the misinformation. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 10 http://nuxeo.com mailto:fg@nuxeo.com
participants (3)
-
Dieter Maurer -
Florent Guillaume -
Vitor Varalonga