On 12 February 2010 13:47, Gunnlaugur Briem <[email protected]> wrote:
> Hi,
>
> [moving my StackOverflow question to the mailing list per Graham
> Dumpleton's suggestion; note his reply there: 
> http://stackoverflow.com/questions/2244244/
> ]
>
> My Django app, deployed using Django's standard WSGIHandler,
> authenticates users via form login on the Django side. So to Apache,
> the user is anonymous, making for an unsatisfying access log.
>
> I want to pass the username back through the WSGI wrapper to Apache
> after handling the request, so that it appears in the Apache access
> log.
>
> Graham's suggestion involves using apswigpy and configuring mod_wsgi
> to pass the Apache request object in as a Python CObject. Even then,
> he says it will only work in embedded mode.
>
> Some follow-up questions:
>
> 1) the apswigpy page says it was abandoned in 2007 due to lack of
> interest, and was then “very much a work in progress”. This sounds a
> tad risky.

I am always happy to address any issues with it and make changes as
necessary. Just till now no one has been interested. I don't want to
see that project die as I find it quite interesting. I just don't have
that much time these days and obviously going to focus on mod_wsgi as
that is where the interest of others is focused.

> Graham being the author of both mod_wsgi and apswigpy, I
> don't suppose I should hope that anyone else here knows a better
> way? :)

There is another way, but apswigpy was the quick way as it was a
generic solution.

The other way is to implement a very small Python C extension module
which is coded just to perform that one operation. Isn't that hard for
me at least to do and gives benefit that doesn't bring all the other
API wrappings that apswigpy provides.

If you really want to go down that path, happy to try and get that C
extension module together for you, but with apswigpy you could at
least test concept first.

> 2) is the limitation to embedded mode just a reference to mod_wsgi's
> (or apswigpy's) current implementation, or is it inherent in the
> Apache invocation model? I.e. will this *continue* to be possible only
> in embedded mode?

It is only possible to make that change to the request object in
embedded mode as that is the real one. The one in daemon mode is a
fake request object and changes to it wouldn't get reflected back in
main Apache server process that proxied the request.

The only way around that would be for mod_wsgi to provide a special
feature whereby you could provide a response header which specifies
the user and mod_wsgi picks that up in main Apache server processes,
whether embedded or daemon mode used and makes update transparently.

> 3) is there a reason why that functionality in apswigpy isn't/
> shouldn't be merged into mod_wsgi as an optional extra? Because
> mod_wsgi wants to stick strictly to implementing only the WSGI spec?

Because users wanted me to stick with mod_wsgi really only being about
WSGI. I did think about making it part of mod_wsgi. But then I would
have still had to maintain it even though no one was using it.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to