[Zope3-dev] Re: zope.testbrowser too trigger-happy with urlencodes?

Tres Seaver tseaver at palladion.com
Mon Jun 26 20:04:51 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Aspeli wrote:
> Hi,
> 
> I've got a situation where a form submit will eventually end up in an
> action that does (in Zope 2):
> 
>     context.REQUEST.RESPONSE.redirect('/path/to/foo/#bar')
> 
> This works fine through the web, but using zope.testbrowser, the # gets
> converted to %23 (which is the correct urlencoding of #). The url
> /pat/to/foo/%23bar is not valid, and I get a 404.
> 
> I couldn't work out where this was being handled in zope.testbrowser, so
> and I guess it may be mechanize or some other library's fault, but I'd
> like to know if (a) it's a bug and (b) how I may work around it; save
> for that, I have one monster of a functional test now exercising a
> pretty complex set of forms and views - and a tutorial on how I did it :)

Note that the fragment identifier is *never* going to be passed to the
server by a "real" browser:  instead, the browser strips of the fragment
part, submits the remainder of the URL to the server, and then does a
search for the appropriate '<a name="bar">' element *on the client side*.

I'm not sure how this is pertinent to the problem you have found, but
Zope will never traverse '#bar' or '%23bar' in the real world.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEoHYj+gerLs4ltQ4RAmVbAJ0dvGvRS6/ayBbVyTXcJvR5ir0G5wCbBMEt
LyhGnkFCTbSztdHEGTF1dKM=
=iOB4
-----END PGP SIGNATURE-----



More information about the Zope3-dev mailing list