No more Zope 2 interfaces

by Alexander Limi last modified Oct 31, 2009 02:24 PM

Versions of Zope 2 prior to Zope 2.12.0 supported two types of interfaces (the old Zope 2 implementation and the new Zope 3 implementation from zope.interface). Now only the latter remains.

In Plone 2.5 and Plone 3, Zope contained two different ways of declaring that a class implements a particular interface.

Zope 2 style
from Interface import Interface

class MyInterface(Interface):
    pass

class MyClass(object):
    __implements__ = (MyInterface,)
Zope 3 style
from zope.interface import Interface

class MyInterface(Interface):
    pass

class MyClass(object):
    implements(MyInterface)

In Zope 2.12, only Zope 3 style interfaces are supported.

Code trying to define Zope 2 interfaces will raise the following exception:

ImportError: No module named Interface