No more Zope 2 interfaces
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
Zope 2 style interfaces removed from ATContentTypes
In Plone 3, the Zope 2 style interfaces were defined in interfaces.py and the Zope 3 ones in the interface folder.
In Plone 4, the Zope 2 style interfaces have been removed and the Zope 3 ones moved to the interfaces submodule, to follow naming conventions. However, a link to these Zope 3 interfaces has been left in interface.py, so the following example code will work in both Plone 3 and 4:
from Products.ATContentTypes.interface import IATFolder
Trying to use implements() with Zope 2 style interfaces will fail.