You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2002/10/04 19:49:08 UTC
cvs commit: httpd-python/lib/python/mod_python publisher.py util.py
grisha 2002/10/04 10:49:08
Modified: . CREDITS
Doc modpython6.tex
lib/python/mod_python publisher.py util.py
Log:
Bugfixes/patches from Robin Munn and other stuff.
Revision Changes Path
1.14 +3 -0 httpd-python/CREDITS
Index: CREDITS
===================================================================
RCS file: /home/cvs/httpd-python/CREDITS,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- CREDITS 12 Aug 2002 02:01:15 -0000 1.13
+++ CREDITS 4 Oct 2002 17:49:07 -0000 1.14
@@ -35,6 +35,9 @@
Miguel Marques <mi...@yorku.ca>
[use of req->request_config instead of atol hack]
+Robin Munn <rm...@pobox.com>
+ [patches]
+
Sean Reifschneider <ja...@tummy.com>
[RH rpm]
1.10 +5 -1 httpd-python/Doc/modpython6.tex
Index: modpython6.tex
===================================================================
RCS file: /home/cvs/httpd-python/Doc/modpython6.tex,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- modpython6.tex 7 Sep 2002 03:53:03 -0000 1.9
+++ modpython6.tex 4 Oct 2002 17:49:07 -0000 1.10
@@ -82,7 +82,11 @@
object expects. This list is compared with names of fields from HTML
form data submitted by the client via \code{POST} or
\code{GET}. 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,
+unless the destination callable object has a \code{**kwargs} style
+argument, in which case fields with unmatched names will be passed in the
+\code{**kwargs} argument.
If the destination is not callable or is a class, then its string
representation is returned to the client.
1.22 +7 -5 httpd-python/lib/python/mod_python/publisher.py
Index: publisher.py
===================================================================
RCS file: /home/cvs/httpd-python/lib/python/mod_python/publisher.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- publisher.py 12 Sep 2002 18:24:05 -0000 1.21
+++ publisher.py 4 Oct 2002 17:49:08 -0000 1.22
@@ -180,11 +180,13 @@
fc = object.im_func.func_code
expected = fc.co_varnames[1:fc.co_argcount]
- # remove unexpected args
- for name in args.keys():
- if name not in expected:
- del args[name]
-
+ # remove unexpected args unless co_flags & 0x08,
+ # meaning function accepts **kw syntax
+ if not (fc.co_flags & 0x08):
+ for name in args.keys():
+ if name not in expected:
+ del args[name]
+
result = apply(object, (), args)
if result:
1.12 +8 -4 httpd-python/lib/python/mod_python/util.py
Index: util.py
===================================================================
RCS file: /home/cvs/httpd-python/lib/python/mod_python/util.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- util.py 12 Sep 2002 18:24:05 -0000 1.11
+++ util.py 4 Oct 2002 17:49:08 -0000 1.12
@@ -168,6 +168,7 @@
sline = line.strip()
while line and sline != boundary:
line = req.readline()
+ sline = line.strip()
while 1:
@@ -176,7 +177,12 @@
ctype, type_options = "text/plain", {}
disp, disp_options = None, {}
headers = apache.make_table()
+
line = req.readline()
+ sline = line.strip()
+ if not line or sline == (boundary + "--"):
+ break
+
while line and line not in ["\n", "\r\n"]:
h, v = line.split(":", 1)
headers.add(h, v)
@@ -186,6 +192,7 @@
elif h == "content-type":
ctype, type_options = parse_header(v)
line = req.readline()
+ sline = line.strip()
if disp_options.has_key("name"):
name = disp_options["name"]
@@ -211,9 +218,6 @@
self.list.append(field)
- if not line or sline == (boundary + "--"):
- break
-
else:
# we don't understand this content-type
raise apache.SERVER_RETURN, apache.HTTP_NOT_IMPLEMENTED
@@ -294,7 +298,7 @@
"""
- plist = map(lambda a: a.strip(), line.splitfields(';'))
+ plist = map(lambda a: a.strip(), line.split(';'))
key = plist[0].lower()
del plist[0]
pdict = {}