[mod_python] Documentation patch (another one) for hand-pub-alg-args.html

rmunn at pobox.com rmunn at pobox.com
Wed Oct 2 09:25:40 EST 2002

Having sent in a patch to hand-pub-alg-args.html just now, I realized
that another paragraph would probably be a good idea, to explain why
it's a bad idea to have any fields called req in the HTML request, since
they would be silently dropped in the publisher.py code. I can just see
someone spending days on figuring out what's happening when all his
fields but one are getting passed through kwargs...

So here's another documentation patch. This one supersedes the doc patch
I just sent -- that is, it's meant to be applied to the original
hand-pub-alg-args.html file, not the updated version that my earlier
patch would produce.

Robin Munn
rmunn at pobox.com

--- doc-html/hand-pub-alg-args.html	2002-09-24 11:59:13.000000000 -0500
+++ doc-html/hand-pub-alg-args.html.new	2002-10-02 09:16:14.000000000 -0500
@@ -58,7 +58,21 @@
 object expects. This list is compared with names of fields from HTML
 form data submitted by the client via <code>POST</code> or
 <code>GET</code>. Values of fields whose names match the names of callable
-object arguments will be passed as strings.
+object arguments will be passed as strings. Any fields whose names do
+not match the names of callable argument objects will be silently dropped.
+But if the destination callable object has a <code>**kwargs</code> style
+argument, then fields with unmatched names will be passed in the
+<code>**kwargs</code> argument instead.
+Note that the HTML request argument is passed as <code>req</code> to the
+callable object, so if the form data had any field called <code>req</code>,
+that field will be inaccessible in the callable object code. Fields called
+<code>self</code> will also cause problems for instance methods. If you
+absolutely must have a field named <code>self</code>, then you'd be well
+advised to call the first parameter of the instance method something else,
+such as <code>instobj</code>, or some other name that won't conflict with
+any field names.
 If the destination is not callable or is a class, then its string

More information about the Mod_python mailing list