[Zope-dev] Zope-Bug affecting my url_quoting (bug in getattr?)
Dieter Maurer
dieter@handshake.de
Tue, 7 Aug 2001 22:43:51 +0200 (CEST)
Your report as some strange elements in it. See below....
Jan-Oliver Wagner writes:
> I just detected a serious bug:
> (in short: to my mind getattr() behaves wrong)
>=20
> http://freegis.org/details.en.html?name=3DGeoprocessamento%3a%20Teoria=
%20e%20Aplica%e7%f5es
>=20
> was produced using <dtml-var name urlquote>.
You should use "url_quote_plus".
Space (i.e. %20) is not allowed as part of the query string.
It must be coded as '+'.
=20
Some browsers are serious about this restriction (e.g. IE 5.5).
> (for those who don't have a browser at hand:
> the attribute is converted back to
> Geoprocessamento: Teoria e Aplica=E7details.en.html5es
> which is obviously wrong)
I used my browser (and Zope 2.3.3). It was converted to
Geoprocessamento: Teoria e Aplica=E7=F5es=20
Precisely, what one would expect....
> Manually using capital letters for the url quoting will work (ie. here
> just '%F5es' at the end of the above URL.
>=20
> Apparantly the %f is substituted by someone by the filename
> (getattr already delivers this error).
> ....
> def unquote_name(self):
> request =3D getattr(self, 'REQUEST')
> if hasattr(request, 'name'):
> name =3D getattr(request, 'name')
> # name already now contains the "%f" substituted by
> # "details.en.html"!!!
> request.set('name', unquote(name))
> return ''
I am sure, "getattr" returns the value that is in "REQUEST"
without substituting "%f" -- it did when I tried to
reproduce your problem!
Maybe, you display "REQUEST" before mangling:
<dtml-var REQUEST>
<dtml-var unquote>
<dtml-var REQUEST>
Why do you want to unquote anyway?
Zope already did it for you! Dangerous to do it a second time!
Maybe, you want to read
URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
for details, how Zope processes parameters.
Dieter