[ZODB-Dev] Closing ZODB connection

Antonio Beamud Montero antonio.beamud at linkend.com
Wed Oct 29 11:05:40 EST 2003


El mié, 29-10-2003 a las 16:57, Jeremy Hylton escribió:
> On Wed, 2003-10-29 at 10:53, Antonio Beamud Montero wrote:
> > Is correct to close the connection this way?
> >    ....
> >    def get_reg_list(self):
> >        con = self.db.open()
> >        root = con.root()
> >        con.close()
> >        return root['status'].get_register_list()
> > It works but can be dangerous?
> 
> It works sometimes, but only by accident.  You should not use a
> connection after it is closed.
> 
> Jeremy
Then in a case as before I need to do something like:
    def get_reg_list(self):
        con = self.db.open()
        root = con.root()
        list = root['status'].get_register_list()
        con.close()
        return list

No?


-- 
Antonio Beamud Montero <antonio.beamud at linkend.com>




More information about the ZODB-Dev mailing list