[Zope-DB] Python Scripts and Database Connections

Dieter Maurer dieter@handshake.de
Sun, 12 May 2002 09:45:06 +0200

William Trenker writes:
 > ....
 > Is there a way to create a Zope DB Connection instance on the fly from a 
 > Python Script?  What I'd like to do is programmatically create a DB 
 > Connection object on the fly, feed it some SQL, again on-the-fly, and then 
 > delete the connection object.
It is possible.

  When your DA uses new style initialization (as it should),

  will give you access to all funtions defined as
  "contructors" in the "context.registerClass".

  Define a function that gives you your newly created DA object.
  It will probably be necessary, to return it wrapped into
  the acquisition context.

I think, the Zope Developper Guide will tell you about new style
product initialization.