[ZODB-Dev] API question

Tres Seaver tseaver at palladion.com
Mon Jan 14 18:32:07 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

While working on preparation for a Py3k port, I've stumbled across a
fundamental issue with how ZODB structures its API.  Do we intend that
client code do the following::

  from ZDOB import DB, FileStorage
  db = DB(FileStorage('/path/to/Data.fs'))

or use the module as a facade ::

  import ZODB
  db = ZODB.DB(ZODB.FileStorage.FileStorage('/path/to/Data.fs'))

I would actually prefer that clients explicitly import the intermediate
modules::

  from ZDOB import DB, FileStorage
  db = DB.DB(FileStorage.FileStorage('/path/to/Data.fs'))

or even better::

  from ZDOB.DB import DB
  # This one can even be ambiguous now
  from ZODB.FileStorage import FileStorage
  db = DB(FileStorage('/path/to/Data.fs'))

The driver for the question is getting the tests to pass under both
'nosetests' and 'setup.py test', where the order of module imports etc.
can make the ambiguous cases problematic.  It would be a good time to do
whatever BBB stuff we need to (I would guess figuring out how to emit
deprecation warnings for whichever variants) before releasing 4.0.0.



Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlD0TycACgkQ+gerLs4ltQ4AgACg3MCYrEOga5KF8goWyu2OxjWe
H7QAoLEyHTShzBc9ZkMENWbG+hqzrpTg
=nBoy
-----END PGP SIGNATURE-----



More information about the ZODB-Dev mailing list