Using DB Connection in Zope Product?
Is there a way to develop a zope product (filesystem based) that can use a Zope DB Connection object that exists in the ZODB? I want to create a product and allow the user to specify the database connection to use. If so, how do you reference an existing object in your product code. Also, can you recommend any good product development tutorials? Thanks in advance. Chris
Chris Bruce wrote:
I want to create a product and allow the user to specify the database connection to use. If so, how do you reference an existing object in your product code.
Acquisition! Product class instances which inherit from the correct base classes will acquire properly. So inside a method for your Product class, you can: self.db_connection.do_something() presuming "db_connection" is the id of a Zope object that will be acquired from your Product. You could also store the "URL" of the object you want to use as a string and then use restrictedTraverse(string) to get a handle to the object itself. HTH, JZ
Is there a way to develop a zope product (filesystem based) that can use a Zope DB Connection object that exists in the ZODB?
I want to create a product and allow the user to specify the database connection to use. If so, how do you reference an existing object in your product code.
http://www.zope.org/Members/jccooper/extzsql
Also, can you recommend any good product development tutorials?
http://www.zope.org/Members/maxm http://www.zope.org/Documentation/Books/ZDG/current/index_html http://www.zope.org/Members/gtk/Boring/HowTo-Boring --jcc (hey, URLs only!)
participants (3)
-
Chris Bruce -
J Cameron Cooper -
John Ziniti