[mod_python] Setting req->user for mod_dav_svn

Jim Gallacher jpg at jgassociates.ca
Tue Aug 1 12:19:05 EDT 2006


Deron Meranda wrote:
> On 7/31/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
>> Deron Meranda wrote ..
>> > Can I set the req->user member from within mod_python (the docs
>> > say it is read-only),
>>
>> In 3.2.8+ it is writable, the documentation is wrong. The documentation
>> in 3.3 is correct.
> 
> Well, I'm not having so much luck with this.  Again I'm at
>   Apache 2.0.52
>   mod_python 3.2.10
>   mod_dav_svn (subversion) 1.3.2
> 
> When you say req.user is writable, is that just for the member of the
> Python "req" object, or does a write also modify the underlying
> Apache C structure's request_rec->user  (char*) member?

request_rec->user is set.

Here is the relavent bit from requestobject.c (3.2.10) in the
setreq_recmbr function (line 1279):
    ...
    ...

    else if (strcmp(name, "user") == 0) {
        if (! PyString_Check(val)) {
            PyErr_SetString(PyExc_TypeError, "user must be a string");
            return -1;
        }
        self->request_rec->user =
            apr_pstrdup(self->request_rec->pool, PyString_AsString(val));
        return 0;

Jim


More information about the Mod_python mailing list