mod_python, multiple calls to PythonAuthenHandler
steve at holdenweb.com
Tue Nov 9 14:36:16 CET 2004
Rune Hansen wrote:
> On Mon, 08 Nov 2004 08:18:45 -0500, Steve Holden wrote:
>>Rune Hansen wrote:
>>>I've posted this question on the mod_python mailing list but didn't get
>>>much response, so I thought I'd post it here.
> Now, I've "solved it" with a single PythonHandler (dropping
> PythonAuthenHandler and publisher):
> def handler(req):
> if not req.headers_in.get("Authorization",0):
> req.err_headers_out["WWW-Authenticate"] = 'Basic realm="Restricted\
> raise apache.SERVER_RETURN, apache.HTTP_UNAUTHORIZED
> meth,auth = req.headers_in.get("Authorization").split(" ")
> user,pw = decodestring(auth).split(":")
> args = dict([(a,a) for a in util.parse_qsl(req.args or '')])
> if dbmdbValidate(user,pw,req.server):
> return myMethod(req,**args)
> return apache.HTTP_UNAUTHORIZED
> This seems to do exactly what I want. Guess I should have tried a litle
> harder before posting.
> How ever, I'm still curious to why the PythonAuthenHandler is called for
> each path element.
I'm afraid that's a little beyond me too, but I think you were quite
within your rights to post the question. Glad you've got past the problem.
Since you're using the publisher handler you might want to consider
using the methods described in
you haven't already looked at them.
Holden Web LLC +1 800 494 3119
More information about the Python-list