From: Christoph Zwerschke <zwerschke@zu...> - 2003-10-01 08:19:08
> Move the self.db line to the module level in sitePage
> db =3D DBPool.....
> Class sitePage(Page):
> def writeContent(self):
> conn =3D db.getConnection.....
Alternatively, you can also set db as a class variable, i.e. directly in =
class definition, not in the __init__ method. If you set db in the __init=
method, you will create a db object for every instance of sitePage, if yo=
set it as a class variable in the class definition, the same db object is
shared by all sitePage instances.
db =3D DBPool.....
conn =3D self.db.getConnection.....
Note that you have to write self.db inside the class to refer to the db
object, instead of db only. All subclasses of sitePage will inherit the d=