durusmail: quixote-users: Bug in form2.form?
Bug in form2.form?
2004-10-03
Bug in form2.form? NOPE!
2004-10-04
[PATCH] to medusa_http.py (Was Bug in form2.form? NOPE!)
2004-10-04
2004-10-04
2004-10-04
2004-10-04
Bug in form2.form?
Jason Sibre
2004-10-03
I FINALLY got around to updating my .7a3 install to 1.0 today.  I had an app
in production that was based on the early version of form2 that needed a lot
of work to be made 1.0 compatible (remember the WidgetRow???).  Aside from
various little quirks here and there (and a mess of reformating work that
still needs to happen thanks to the shift from tables to divs for layout),
it wasn't too bad.  Not as bad as it could have been, anyway.

To the point:  There seems to be a bug in form2.form.  The action_url gets
quoted.  I would say this is wrong.  My app actually uses IDs that require
urlquoting.  A sample url is
http://prototype.sibre.org:8081/admin/sites/prop1.sibre.org%3A8081/edit.
Note that part of the url is "prop1.sibre.org:8081" which is url_quoted to
become "prop1.sibre.org%3A8081".

The line which reads "action_url = url_quote(request.get_path())" will
FURTHER url_quote this to become "prop1.sibre.org%253A8081", and subsequent
posts would become "prop1.sibre.org%25253A8081",
"prop1.sibre.org%2525253A8081", etc, if it didn't cause an error in my app
after the first post.

I'm using medusa to witness this problem, but I don't think that matters.
I'm pretty sure that no matter which web server you're using,
request.get_path() is going to return the requested url verbatim (i.e. not
unquoted), therefore quoting it just double-quotes it (or triple-, etc)

Here's the patch:


--- /usr/local/lib/python2.3/site-packages/quixote1/form2/form.py
2004-06-07 17:23:11.000000000 -0500
+++ /usr/local/lib/python2.3/site-packages/tmp/quixote/form2/form.py
2004-10-03 15:17:48.000000000 -0500
@@ -107,7 +107,7 @@

     def _get_default_action_url(self):
         request = get_request()
-        action_url = url_quote(request.get_path())
+        action_url = request.get_path()
         query = request.get_environ("QUERY_STRING")
         if query:
             action_url += "?" + query



Let me know if you think this will break anything else.  Frankly, I don't
see how it could, but I may be overlooking something.

Jason



reply