[Zope-dev] ZSQLMethod/Z Database Connection namespace

Dieter Maurer dieter@handshake.de
Tue, 29 Oct 2002 20:56:58 +0100


Jeff Coleman writes:
 > I have a product that stores customer information in mysql using
 > ZSQLMethods. 
 > I would like each customer to have a different mysql database (same
 > structure), but all use the same ZSQLMethods for access.
 > So, I tried the following:
 > / - root contains ZSQLMethods and default DB Connector (seems to be
 > required for editing the methods)
 > /CustomerA - contains DB Connector with same name as in root, but uses
 > different mysql database
 > /CustomerB - contains DB Connector with same name as in root, but uses
 > different mysql database
 > 
 > And assumed that /CustomerA/showdata would use the DB Connector in the
 > 'CustomerA' directory, but no matter what it uses the DB Connector in
 > the root directory.  It seems that the ZSQLMethods namespace is put on
 > top and any other DB Connectors are ignored.
 > Is this intentional or a bug?
It is intentional and called "Containment before Context".
Read the acquisition section in

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>

to learn more about it.

It was implemented this way mainly because the security framework
should be based on acquisition too, and there, you do not want
that the context can override the security policies defined higher
up in the hierarchy.


Dieter