[mod_python] PSP global variables

Graham Dumpleton grahamd at dscpl.com.au
Sun Nov 5 18:18:43 EST 2006


Clodoaldo Pinto Neto wrote ..
> 2006/11/5, Graham Dumpleton <grahamd at dscpl.com.au>:
> > Unfortunately there isn't any way (that I know of), of specifying using
> just
> > Apache configuration directives, that 'PythonDebug On' apply only to
> a
> > specific client site. What one can do though is use a transhandler(),
> if in
> > main configuration, or some later handler if in directory context and
> have:
> >
> >   def transhandler(req):
> >     if req.connection. remote_ip in ['...']:
> >       req.get_config()['PythonDebug'] = '1'
> >     else:
> >       req.get_config()['PythonDebug'] = '0'
> >     return apache.DECLINED
> >
> > In some respects a later handler might be better as you can possibly
> > override anything set in the Apache configuration to force such a policy.
> > Users could still override you again, in their own handler, but makes
> > them do one extra non obvious step.
> >
> > One could even get quite tricky and require the presence of a special
> > cookie in the request, with the only way of getting the cookie being
> to
> > have logged into some special page of your web site and have it enabled.
> 
> This is quite instructive. I don't know if you are suggesting to
> include it in the tutorial. I fear that if i mention a transhandler in
> a PSP tutorial the reader will flee in terror to never look back.

Only mentioned it for the benefit of others who have used mod_python for
a while. Definitely should not be in a beginners tutorial.

Graham


More information about the Mod_python mailing list