[mod_python] PythonOption access

Robert Brewer fumanchu at amor.org
Fri Jan 21 11:39:20 EST 2005


Bo Lorentsen wrote:
> Robert Brewer wrote:
> >Not at all. Use the PythonImport directive to load a "global" module
> >when Apache starts, and have that module inspect and preserve
> >PythonOption values.
> >
> How would I inspect "PythonOption" values from a 
> PythonImport'ed module 
> ? I still have no access to the "req" object given to the 
> handlers, otr 
> even parts of it !

As Graham pointed out, by inspecting the result of apache.config_tree().
That will be a list of tuples, one for each top-level directive in your
httpd.conf (or any other .conf which you Include in httpd). Find the one
for the Directory/Files/Location section you're interested in. Following
that entry will be a list of directive-tuples within that section. Short
example:

[('PythonImport', 'junct.startapp REDROVER.HQAMOR.amorhq.net'),
 ('Alias', '/junct D:\\htdocs\\junct'),
 ('<Directory', 'D:\\htdocs\\junct>'),
     [('AddHandler', 'python-program .htm'),
      ('PythonHandler', 'cation.html.uiwsgi::mod_python_handler'),
      ('PythonOption', 'application junct.startapp::get_wsgi_app'),
      ('PythonDebug', 'On'),
      ('DirectoryIndex', 'topic.htm'),
     ]


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Mod_python mailing list