python class question
Axel Bock
news-and-lists at the-me.de
Mon Jul 29 05:45:17 EDT 2002
On Fri, 26 Jul 2002 23:27:23 +0200, Jonathan Hogg wrote:
> On 26/7/2002 18:32, in article ahs0to$v8ku5$1 at ID-138381.news.dfncis.de,
> "Axel Bock" <news-and-lists at the-me.de> wrote:
>
> Well just put the code you originally wrote into a method something like
> so:
>
> def getDB( self ):
> dbc = getattr( self, self.connection ) DB = dbc()
> return DB
>
> Then use this in your methods when you need to talk to the database:
>
> def doSomething( self, withThis ):
> DB = self.getDB()
> result = DB.query( withThis )
> return result.getOne()
>
> or something along those lines.
>
> I'm not sure I quite understand what you're trying to do in the first
> place though. Isn't the point of Zope that it manages the database for you
> and provides an object persistence mechanism?
I'm not sure what I'm doing either ;-)), but as long as it works I really
don't care right now :-))
But thaks for that tip, this is like I do it right now.
Greetings and thanks,
Axel.
More information about the Python-list
mailing list