[Zope3-dev] "Sub interface"

Jim Fulton jim at zope.com
Sun Feb 29 12:02:45 EST 2004


Stephan Richter wrote:
> On Sunday 29 February 2004 00:27, Terry Hancock wrote:
> 
>>A sub-interface inherits from Interface.Attribute, but
>>has an extra property specifying the expected interface
>>of the attribute.
> 
> 
> For this we have fields. I just checked and you cannot specify the interface 
> of a field,

Yes you can:

import zope.interface
import zope.schema


class IFoo(zope.interface.Interface)

   myattr = zope.schema.Object(schema=IBar)


This schema field type was added in the Winter 2003 OzZope
sprint.  It is undortunate that the keyword argument name
is scheme. This should be changed to interface, or perhaps type.

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list