[mod_python] import site errors, and constant modules (Re)loading

Joshua Schmidlkofer menion at asylumwear.com
Tue Dec 9 13:08:55 EST 2003


Micheal,

  Thanks for keep up with me..... I moved everything to a separate
module, and I imported the module, used the db connection, etc. 

   Is it possible that I am not returning properly?   When you are using
the publisher handler, all the documentation and examples I have seen
have a "return content" at the end.  So I am storing everything in a
string, and "return"ing at the end of my handler method.  

  I can't figure this out, nothing is getting garbage collected, and
that must mean it is still in scope in some context or other.  


  idea?

thanks,
  Joshua



On Tue, 2003-12-09 at 13:04, Michael S. Fischer wrote:
> In my own work, the connection-handling code is in a separate module. 
> Though, if you do it right, it should work identically in the mod_python 
> module, assuming mod_python is not reloading the module.
> 
> --Michael
> 
> Joshua Schmidlkofer wrote:
> 
> > On Tue, 2003-12-09 at 12:39, Michael S. Fischer wrote:
> > 
> >>Yeah, try something like this:
> >>
> >><module 'db'>
> >>
> >>_conn = None
> >>def getConnection():
> >>    global _conn
> >>    if not _conn:
> >>       _conn = ...  # Get connection
> >>    return _conn
> >>
> >>See if something like that works.
> >>
> >>Joshua Schmidlkofer wrote:
> > 
> > 
> > Yeah, I pretty much have this exact logic - save one thing - is this in
> > a separate module that get imported?  Was that what your first message
> > said?
> > 
> > thanks,
> >   Joshua
> > 
> > 
> > 
-- 
I refuse to believe that the really hot, Debian-using,
password-sniffing, root-exploiting geek girl is a myth. -- g1zmo



More information about the Mod_python mailing list