[Zope] ZSQL with different user

J Cameron Cooper zope-l at jcameroncooper.com
Mon Dec 19 12:42:00 EST 2005


Pier Luigi Fiorini wrote:
> Hello,
> I'm developing a Zope application that uses a PostgreSQL connection and 
> several ZSQL objects.
> People should log in using a Postgres user and ZSQL object should be executed 
> by the user that's logged in. Multiple people can be logged at the same time.
> Unfortunately it is not possible because the same Postgres connection is used 
> by all the ZSQL object. Is there a way to change the user executing a ZSQL 
> query?
> 
> An alternative would be to log into the event.log some information (like the 
> username, that's stored in the session) and the query source.

Your alternative is dead easy. zLOG (or, better, the Python logging 
module, for which zLOG is now a facade) is quite easy to use. You can 
even make your own log file to contain only such events.

		--jcc
-- 
"Building Websites with Plone"
http://plonebook.packtpub.com


More information about the Zope mailing list