> Webware.MiscUtils.DBPool

That'll work for me.  This is what I did, let me know if I did it
wrong:

__init__.py:
def contextInitialize(app, ctxPath):
        from MiscUtils.DBPool import DBPool
        import pgdb
        app.dbPool = DBPool(pgdb, 10, 'myhost:mydb:myname:mypw')

SitePage.py:
class SitePage(Page):
        def db(self):
                """
                        Usage:
                        ==================================
                        db = self.db()
                        c = db.cursor()
                        c.execute("select * from Book")
                        rs = c.fetchall()
                        for r in rs:
                                self.writeln(r[0])
                """
                return self.application().valueForKey('dbPool').getConnection()



If this is right, should some of it be added to the docstring for
DBPool?  Currently it tells how to create the dbPool but not how to
make it persist beyond a single servlet call.



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

Reply via email to