[z3-five] Re: Five fails on my 2.8 instance

Tim Hicks tim at sitefusion.co.uk
Tue Nov 16 16:00:13 MET 2004


Philipp von Weitershausen said:

>>>Yes, this makes sense because in Zope 2.8, the IPersistent interface is
>>>an Interface.Interface (old-style) whereas in Zope 2.7, it is a
>>>zope.interface.Interface (new-style). Once we support Zope 2.8, we'll
>>>have to think about what to do with that.
>>
>> Either I don't follow properly or that's a little strange.  Why would
>> 2.7
>> use 'new-style' interfaces while 2.8 uses 'old-style'.
>
> 2.7 doesn't use new-style interface, Five does :). In 2.7, IPersistent
> doesn't exist, so we just make a stub one (Five/interfaces.py, line 25).
> 2.8 and X3.0 share ZODB 3.3 which *does* have IPersistent, but
> apparently it's not being instantiated as a new-style interface (even
> though it should).
>
> Off the top of my head I'd suspect that for some reason,
> persistent/interfaces.py does not find zope.interface as it should and
> thus does not create IPersistent as a new-style interface. Maybe you can
> track down the problem, it might have to do something with the Python
> Path.


Yes, my very limited investigations confirm this.  I have the following
line in my zope.conf::

  path /the/correct/path/to/zope3/lib/python

Not sure if this is related, but I had to manually add this path to
sys.path in one of my products' __init__.py because it gets imported early
(it starts an SMTP server) and apparently the path directive has not taken
effect by then.

So, zope3 should be in the path, still [zope3]/persistent/interfaces does
indeed fail on::

  from zope.interface import Interface

which I confirmed with a print statement in the except clause that follows
it.  I don't know why this should be.


> For a starter, you could change Five.interfaces.ISimpleItem to not
> include IPersistent for the moment and take it from there. Maybe the
> changes that are needed to make Five 2.8-compatible are trivial...


I made it work by hiding the problem rather than fixing it (I suppose). 
My Five.interfaces module now looks like::

  try:
      from persistent.interfaces import IPersistent
      if not isinstance(IPersistent, Interface):
          raise ImportError
  except ImportError:
      class IPersistent(Interface):
          """Persistent object"""

Works for me.


cheers,

tim


More information about the z3-five mailing list