Fabio schrieb:
> Hi!
> in my zope application I call ZSQLMethods from python script. Is it possible 
> to set "connection id" property of a ZSQLMethod before call it?
> 
> How?
> ZSQLMethod.propertyItems() return only ('title','')

If you set it only one time, you should be able to read it from ZMI
page how to set it (just lookup the method call of the form
and the variables it takes)

If however you want to change it on every call, your ZODB is
going to bloat badly - every change is saved.

In this case you might want to create 2 folders and put
both database connection objects with identical ID
in each of them:

somewhere/aconnectionfolder/dbconnection
somewhere/bconnectionfolder/dbconnection

and set in all your ZSQL methods "dbconnection"
as connection (perhaps while you edit them, use
this path:

somewhere/aconnectionfolder/whereyourzsqlmethodis/yourzsqlmethod/manage_main

where "whereyourzsqlmethodis" does not have to be physically
there (read about Acquisition)

Now, if you want to use one or the other connection, just use:

context.somewhere.aconnection.pathtoyourzsqlmethods.yourzsqlmethod(params...)

or

context.somewhere.bconnection.pathtoyourzsqlmethods.yourzsqlmethod(params...)

while you can even parametrize the path as usually.

HTH
Tino
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to