[Zope] Changing DA

Jim Penny jpenny@universal-fasteners.com
Wed, 14 Aug 2002 10:43:31 -0400


On Wed, Aug 14, 2002 at 12:33:50PM +0200, Andreas Kostyrka wrote:
> Am Die, 2002-08-13 um 19.32 schrieb Jim Penny:
> > Suppose, I have many ZSQL methods using the foo DA, and want to switch,
> > or at least test the bar DA.
> > 
> > How do I programatically make the switch?

I think that http://www.zopelabs.com/cookbook/1003271138 can be modified
to do what I want.  I will know later today.

> > 
> > I could swear that this has come up before, but I cannot find it.
> How about creating a new "bar" connection object with the same id? 

Very distasteful.  Then I might see that I was working with the "foo
adatper" when the "bar adapter" was really processing it, and
acquisition could even disguise the fact.  Ouch!

> > 
> > On a related question -- how does one determine the set of available
> > connection ids?
> look at
> lib/python/Products/ZSQLMethods/SQL.py:SQLConnectionIDs

Thanks.  The context I was in was so bizarre that I hope no one else
needs this.  (I have a home-brew UserFolder that holds a connectionID, 
I wanted to change it over to another DA without deleting and
re-installing the UserFolder.)

Anyway, on the off chance that anyone else will ever need something 
like this, I did an external method, whose guts was:

self.acl_users.connection_id=self.this().aq_acquire('Bar_database_connection')


See, easy!  (Actually, it was...)

Thanks again.

Jim

> 
> Andreas
>