Tim Peters wrote:
> [Florent Guillaume]
Also I don't understand why open()'s "delegate" attribute is not stored
as a connection attribute, and close() should reuse it instead of
obeying a "primary" attribute.  Anyway, I guess historical code, etc.

No, according to SVN, Jim added Connection.open()'s `delegate` argument and
Connection.close()'s `primary` argument late in the game (months after
multidb support was first added).   AFAICT, there are no docs or tests (of
non-default values) for them, and IConnection.close() wasn't changed to say
that Connection.close() grew a new argument.  I don't really know why they
were added.  Jim?  This was the checkin comment on the revision that added
both of them, and they haven't been changed since:

    r30816 | jim | 2005-06-16 16:21:27 -0400 (Thu, 16 Jun 2005) | 9 lines

    Greatly simplified the internal dance to create, open, and close
    connections.   Connections now get their database and related data
    when they are constructed.  They no longer throw away this information
    when they are closed.  (The old design that threw away the database
    and related data did so to avoid memory leaks in Python 1.)

    Fixed a multi-database connection-management bug. (The fix
    necessitated the simplification.)

The delegate and primary arguments aren't meant to be part of the
public API. They are used internally by open and close.  I didn't add these
arguments so much as add an open method and refactor the way close
worked.  What I should have done was to add _open and _close methods
to handle the associated connections.  There should be tests
to assure that when a connection is opened or closed, it's associated
connections are opened or closed as well, although I don't immediately
see these tests. :(

Open's delegate argument isn't stored because it's always True, at least when
called from "outside" code.  Application code should never pass this
argument.  Again, thse arguments are not part of the API.

I'll respond to the original issue separately.


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to