[mod_python] Passing C structure into python?

Gregory (Grisha) Trubetskoy grisha at verio.net
Thu Mar 15 17:31:33 EST 2001


I think req->notes is your best bet. Look at mod_python.c in
get_request_object() for an example. It's not pretty, but it works....

Grisha

On Thu, 15 Mar 2001, Miguel Marques wrote:

> Greetings...
>
> I previously had a authentication handler written in python which
> using a python extension opened a connection a database.
>
> Since the main request handler was also written in python and needed
> to use that connection to the database I just assigned the connection
> object to a member of the request object in the authentication
> handler.  The main request handler then could access the database
> connection using that member of the request object.
>
> I have now rewritten the authentication handler as an apache module
> written in C but I still would like to pass that connection to the
> database into the main request handler which is written in python.
> (I'm opening a connection to the database on both places right now
> which is impacting performance)
>
> Any idea how I could do that?  I assume I'll need another python C
> module to return me a python variable to use in the main request handler.
> The question is where do I store the connection C structure in the
> authentication handler so that the handler can get at it?
> I don't think I can use the notes field for that.
>
> Any help would be greatly appreciated...
>
> 						Miguel
>
> C. Miguel Marques, York University, Computing & Network Services
> e-mail: miguel at yorku.ca, voice: (416)736-2100x22684, fax: (416)736-5830
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list