Graham Dumpleton wrote ..
> Grisha wrote ..
> > 
> > On Thu, 3 Nov 2005, Graham Dumpleton wrote:
> > 
> > > With the thought of mod_python perhaps ignoring the PythonEnabledPdb
> > > option when not run in single process mode, is there a way using the
> > > apache.mpm_query() function or some other function of determining that
> > > Apache is running in single process mode?
> > 
> > I wonder if simply examining sys.argv would work?
> 
> Can't be done this way as sys.argv doesn't even exist in mod_python.
>
> ...
> 
> Also need to sort out how -DONE_PROCESS and -X options are
> different, as pdb support also works if -X option is used. This is
> probably dangerous though to use as you still potentially get
> child processes and thus fire off more than one request and they
> will fight over standard input.

To determine if -DONE_PROCESS was used on the command line,
noting that -X is equivalent to -DONE_PROCESS and -DNO_DETATCH,
one can use in the Apache configuration file:

  <IfDefine ONE_PROCESS>
  PythonEnablePdb On
  </IfDefine>

As far as I can tell, the IfDefine directive uses the Apache C function:

  ap_exists_config_define()

Ie., the defined symbol is the argument:

  ap_exists_config_define("ONE_PROCESS")

Unless I am missing something, there is no equivalent to being able
to do IfDefine from within Python code executing inside of mod_python.
It sounds though that in this case with pdb that it might be a potentially
useful feature.

Thus, what do people think about a new function:

  apache.exists_config_define(arg)

Graham

Reply via email to