[Zope-dev] Re: Interfaces in Zope 2.5, 2.7, and 3.x

Martijn Faassen faassen at infrae.com
Thu Mar 4 13:10:40 EST 2004


Jim Fulton wrote:

>> Martijn's suggestion was to use an alternate name for the 
>> "__implements__" attribute.  I suppost I could do that -- call mine
>>  "__narya_interfaces__", but that sounds ugly.  In particular, I
>> don't really want my interfaces module to actually *conflict* with
>> Zope's.
> 
> 
> As I mentioned on the zope3-dev list, you want to use the facade
> Interface from (Packages3/Interface) in Zope 2.7. This is a bit of a
> pain to set up. The facade will be a standard part of Zope 2.8.

As a note so Terry also sees; I couldn't get this to work.

Setting it up using the zope.conf 'path' setting in Zope 2.7 to include 
this on the Python path fails, as Zope actually imports the old (non 
facade) interface package before it gets to do configuration. This means 
the facade never is imported, as the next imports will re-use the cached 
   initial import.

So I moved on to removing Zope 2's Interface package and replacing it 
with the facade Interface. For some reason I couldn't get this to start 
either. Perhaps I was fiddling with the paths wrong, but I couldn't get 
Zope 2.7 to start.

I've since gone back to my own hack using a different __implements__ 
attribute. Since Zope 3 interfaces use the 'implements()' directive 
anyway, this hack only breaks backwards compatibility to Z3 interfaces 
that *do* use __implements__ (this is deprecated however), and could 
break ZODB portability in case of persistent interfaces (there are 
currently pretty uncommon and I don't need them at the moment).

Perhaps Terry did get this to work; if so I'm curious to find out how.

Regards,

Martijn




More information about the Zope-Dev mailing list