On 19/02/2006, at 9:35 AM, Jim Gallacher wrote:
I just noticed that "write" is declared twice in request_methods
[] . What's up with that??
src/requestobject.c
--------------------
static PyMethodDef request_methods[] = {
...
... line 1075
{"write", (PyCFunction) req_write, METH_VARARGS},
...
... line 1087
{"write", (PyCFunction) req_write, METH_VARARGS},
...
For my WTF moment, have a look at test_req_get_basic_auth_pw in the
test suite. I guess it is supposed to be test req.get_basic_auth_pw
(), but
that function isn't even mentioned anywhere. Plus the authenhandler
phase
will not even be run since there is no Require directive in the
configuration.
Even if you add the Require directive, it seems to be testing the
mod_auth
module and not the ability to call req.get_basic_auth_pw().
Would it perhaps be better as:
def test_req_get_basic_auth_pw_conf(self):
c = VirtualHost("*",
ServerName("test_req_get_basic_auth_pw"),
DocumentRoot(DOCUMENT_ROOT),
Directory(DOCUMENT_ROOT,
SetHandler("mod_python"),
AuthName("blah"),
AuthType("basic"),
#PythonAuthenHandler
("tests::req_get_basic_auth_pw"),
PythonHandler
("tests::req_get_basic_auth_pw"),
PythonDebug("On")))
return str(c)
def req_get_basic_auth_pw(req):
req.get_basic_auth_pw()
if req.user != "spam":
req.write("test failed")
else:
req.write("test ok")
return apache.OK
Graham