[Zope] Change ZSQLMethod connection id

Tino Wildenhain tino at wildenhain.de
Fri Dec 23 13:44:42 EST 2005


Fabio schrieb:
> 
>>No its not. Thats whe whole point. You can always
>>look up
>>context.somewhere[variable].yourzsqlmethods.yourzsqlmethod(params...)
>>
>>where variable holds the name of the connection folder.
> 
> 
> I make an example.
> 
> two user:
> 
> pippo -> db connection: dbpluto (holds in session in dbname var)
> pluto -> db connection: dbpippo (holds in session in dbname var)
> 
> when pippo call /include/utils/getData I want to execute query using dbpippo
> when pluto call /include/utils/getData I want to execute query using dbpluto
> 
> how can I call getData?
> in this way:
> "here/context/SESSION/dbname/include/utils/getData" ?
> 
> I think isn't right but I don't know how set "somewhere[variable]" of your 
> example.

This example is completely wrong. First you need to read:

http://www.plope.com/Books/2_7Edition/Acquisition.stx

and:

http://www.plope.com/Books/2_7Edition/BasicScripting.stx

You would code your access to the zsql method in a python script.

And I dont know why you mess with sessions anyway - if its a
user, it has been logged in and you know his/her name via
User API (also look into the book)

I cant do it all for you :-) You will know how to read
my example when your read the book chapters :-)

My advice however is to stick to one connection and
perhaps use the username as argument for housekeeping
or whatever you do.

HTH
Tino


More information about the Zope mailing list