Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB

Changing a Z SQL Method's connector dynamically

 

 

Zope db RSS feed   Index | Next | Previous | View Threaded


josecarlos.balderas at gmail

Jun 29, 2006, 11:50 PM

Post #1 of 2 (1114 views)
Permalink
Changing a Z SQL Method's connector dynamically

Greetings. I have a question regarding Z SQL Methods and their connector.
I need to be able to change their connector dynamically, using a python
script, which will select the connector depending on the parameters passed
to the script. I'll give you an example:

Suppose I have three connectors, each one of them pointing to different
databases (they all have the same tables and fields).
I also have one Z SQL Method that does "Select * from table". When I create
such method, I provide a connector using the dropdown list (that'll be the
connector by default).
I need to create a script, called selectConnector.py, which receives an
integer parameter (n). If n equals 1, the first connector will be chosen for
the Z SQL Method; if n equals 2, the second one will be chosen, and so on...

I've tried accesing the connection_id property from the Z SQL Method. I can
read it to a variable doing the following:

conn = context.zSQLMethod.connection_id

That way, I'll have a variable conn containing the connector id. What I need
to do is change that connector. If I code

context.zSQLMethod.connection_id = <inserts name of new connector here>

I get a TypeError: attribute-less object (assign or del).

Please, give me a hand, and tell me a way to modify that property from a
script.

Thank you very much in advance.


lists at zopyx

Jun 29, 2006, 11:52 PM

Post #2 of 2 (1048 views)
Permalink
Re: Changing a Z SQL Method's connector dynamically [In reply to]

--On 30. Juni 2006 08:50:26 +0200 Jose Carlos Balderas Alberico
<josecarlos.balderas [at] gmail> wrote:

> Greetings. I have a question regarding Z SQL Methods and their connector.
> I need to be able to change their connector dynamically, using a python
> script, which will select the connector depending on the parameters passed
> to the script. I'll give you an example:
>
This issue has been already discussed some weeks ago. Please look in the
mailinglist archives first.

-aj

Zope db RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.