>
> Another approach is to put your initialization code into a
> regular Python
> module.  Then you just import it and use the variable.  This
> works because
> modules only get imported once, plus the imports are guaranteed to
be
> thread-safe.  For example:
>
> MyDBPool.py:
> from MiscUtils.DBPool import DBPool
> import pgdb
> myDBPool = DBPool(pgdb, 10, 'myhost:mydb:myname:mypw')
>
> SitePage.py:
> from MyDBPool import myDBPool
> class SitePage(Page):
>          def db(self):
>                  return myDBPool
>

Good point, I'll move my dbPool to SitePage.py.  Much easier to find
there.  Less magic going on... :)




_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to