[Zope-DB] per user connection with SQLRelay
Matthew T. Kromer
Fri Aug 1 14:50:35 EDT 2003
Well, thats the right general idea.
The problem is that when it needs to connect, you're going to have to
lean on an acquisition wrapper somewhere to locate some thread globals
(ie AUTHENTICATED_USER) and grab state based on that user key.
You basically do not have the opportunity to prompt for the SQL userid &
password, so you need to get those values established in advance by
another page, and stored in a persistent object keyed on authenticated
user so you can pick it up later.
Needless to say, I dont like storing passwords, even in memory.
Andreas Kaiser wrote:
>I want to have per-user database connections to Oracle 8/9 from Zope.
>The best approach i've found so far was described in a thread on this
>list in December 2002:
>Dieter suggests to use SQLRelay and to 'create a DA variant that
>switches users in its "register" method'.
>This is from ZSQLRelayDA/db.py:
> class DB(TM):
> def _begin(self):
> self.con = PySQLRDB.connect(self.host, self.port,
> self.socket, self.user,
> self.cur = self.con.cursor()
> def _finish(self, *ignored):
> def _abort(self, *ignored):
>As far as I understand Zope's transaction management, each request
>consists (at least) of one transaction and every transaction is
>completed within one request.
>If this is true, I could provide the authentification arguments to the
>1. Is this true?
>2. How can I get the needed values? I'm for sure totally blind, but I
> really don't see how to access them from this class/method...
>Zope-DB mailing list
Zope Corporation http://www.zope.com/
More information about the Zope-DB