[Zope-dev] Versions: should they die?

Dieter Maurer dieter@handshake.de
Thu, 5 Jun 2003 22:05:16 +0200


Oliver Bleutgen wrote at 2003-6-4 18:24 +0200:
 > ...
 > As you and Guido are talking about the ZMI (which means, AFAIK, the 
 > managament interface), let me just say that as far as I understand it, 
 > deprecating/marking-as-evil and even removing OFSP/Version.py is not 
 > what I would like to see happen (not only).
 > 
 > The problem lies in ZODB.ZApplication.ZApplicationWrapper
 > 
 >   def __bobo_traverse__(self, REQUEST=None, name=None):
 >          db, aname, version_support = self._stuff
 >          if version_support is not None and REQUEST is not None:
 >              version=REQUEST.get(version_support,'')
 >          else: version=''
 >          conn=db.open(version)
 >    ...
 > 
 > As I understand it, even if the Version product is removed, just putting 
 > at variable named 'Zope-Version' into the REQUEST will cause reads and 
 > writes to happen in a version.
 > Am I missing something here?

No, you are right.

I see two possible solutions:

  1.  Make "version_support" dependent on the existence of
      a product that knows how to enable it.

      The "Version" product could use monkey patching to enable
      version support.

  2.  Use the newly opened connection to check that
      "version" refers to a version object.

2. is much safer but makes version requests slightly more expensive.
However, this should not be a real problem.


Dieter