[mod_python] Debugging active classes

Tiago Becker tiagobecker at gmail.com
Mon Jan 5 10:52:07 EST 2009


damn reply button :-)

On Mon, Jan 5, 2009 at 1:51 PM, Tiago Becker <tiagobecker at gmail.com> wrote:

> We had the same problem here.
> Try making the connection outside the function mod_python calls...
> something todo with the reloadable modules, idk for sure, someone else
> should be able to explain in details....
>
> something like
>
> .....
> from mod_python import apache
>
> cfg = apache.import_module('cfg')
>
> def indef(req):
>   #dont connect here... if you need to pass the connection obj around, you
> can do something like
>   req.myConnection = cfg.Connection
>   #and then pass the req
> ....
>
>
> The database connection should be put in the cfg (or another file,
> whatever)...
> I hope that helps
>
>
>
>
>
>
>
> On Mon, Jan 5, 2009 at 12:52 PM, Johannes Bauer <dfnsonfsduifb at gmx.de>wrote:
>
>> Hello list,
>>
>> I'm doing some webapplications using mod_python and Cheetah. Recently I
>> experienced some trouble with database access: using the Postgres pgdb
>> module I instanciate classes which connect to the db in the constuctor
>> and should release all references to th econnection in the destructor
>> (hence, closing the connection).
>>
>> However, this is not happening. The destructor does not seem to be
>> called. This is why I suspect that some other code holds a reference to
>> my class, causing it not to be destroyed. Is there a way to debug what
>> classes are loaded within mod_python and possibly what memory regions
>> hold references there? How does one go about debugging such a problem? I
>> first would have to find out whether the problem lies within pgdb,
>> Cheetah or (most likely) my code...
>>
>> Regards,
>> Johannes
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20090105/04dc14cb/attachment.html


More information about the Mod_python mailing list