Trees | Index | Help |
|
---|
Package zope :: Package interface :: Module interface :: Class InterfaceClass |
|
object
--+ |Element
--+ |object
--+ | | |SpecificationBasePy
--+ | | |Specification
--+ | InterfaceClass
Method Summary | |
---|---|
__init__(self,
name,
bases,
attrs,
__doc__,
__module__)
| |
Adapt an object to the reciever | |
Adapt an object to the interface | |
Make interfaces sortable TODO: It would ne nice if: More specific interfaces should sort before less specific ones. | |
__contains__(self,
name)
| |
__d(self,
dict)
| |
Return the attribute description for the given name. | |
__gt__(self,
other)
| |
__iter__(self)
| |
__lt__(self,
other)
| |
__reduce__(self)
| |
__repr__(self)
| |
Retrieve a named interface. | |
Return a defered class corresponding to the interface. | |
direct(self,
name)
| |
getBases(self)
| |
Return the attribute description for the given name. | |
Return an iterator for the interfaces in the specification | |
Same interface or extends? | |
Return the attribute names defined by the interface. | |
Return attribute names and descriptions defined by interface. | |
queryDescriptionFor(self,
name,
default)
| |
validate object to defined invariants. | |
Inherited from Element | |
Returns the documentation for the object. | |
Returns the name of the object. | |
Returns the value associated with 'tag'. | |
Returns a list of all tags. | |
Returns the value associated with 'tag'. | |
Associates 'value' with 'key'. | |
Inherited from Specification | |
We, or something we depend on, have changed | |
Does the specification extend the given interface? | |
Query for an attribute description | |
| |
| |
Is the interface the same as or extend the given interface | |
Is the interface implemented by an object | |
| |
| |
| |
Inherited from SpecificationBasePy | |
Do instances of the given class implement the interface? | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Property Summary | |
---|---|
Inherited from Specification | |
__bases__ |
Class Variable Summary | |
---|---|
Implements |
__implemented__ = <implementedBy zope.interface.interfac...
|
ClassProvides |
__provides__ = <zope.interface.declarations.ClassProvide...
|
Inherited from Element | |
ClassProvides |
__providedBy__ = <zope.interface.declarations.ClassProvi...
|
Method Details |
---|
__adapt__(self, obj)Adapt an object to the reciever This method is normally not called directly. It is called by the PEP 246 adapt framework and by the interface __call__ operator. The adapt method is responsible for adapting an object to the reciever. The default version returns None:>>> import zope.interface >>> class I(zope.interface.Interface): ... pass >>> I.__adapt__(0)unless the object given provides the interface: >>> class C(object): ... zope.interface.implements(I) >>> obj = C() >>> I.__adapt__(obj) is obj TrueAdapter hooks can be provided (or removed) to provide custom adaptation. We'll install a silly hook that adapts 0 to 42. We install a hook by simply adding it to the adapter_hooks list: >>> from zope.interface.interface import adapter_hooks >>> def adapt_0_to_42(iface, obj): ... if obj == 0: ... return 42 >>> adapter_hooks.append(adapt_0_to_42) >>> I.__adapt__(0) 42 Hooks must either return an adapter, or None if no adapter can be found. Hooks can be uninstalled by removing them from the list:>>> adapter_hooks.remove(adapt_0_to_42) >>> I.__adapt__(0) |
__call__(self,
obj,
alternate=<object object at 0xb7e6e440>)
|
__cmp(self, o1, o2)Make interfaces sortable TODO: It would ne nice if: More specific interfaces should sort before less specific ones. Otherwise, sort on name and module. But this is too complicated, and we're going to punt on it for now. For now, sort on interface and module name. None is treated as a pseudo interface that implies the loosest contact possible, no contract. For that reason, all interfaces sort before None. |
__getitem__(self,
name)
Return the attribute description for the given name.
|
_getInterface(self, ob, name)Retrieve a named interface. |
deferred(self)Return a defered class corresponding to the interface. |
getDescriptionFor(self, name)Return the attribute description for the given name. |
interfaces(self)Return an iterator for the interfaces in the specification for example:>>> from zope.interface import Interface >>> class I1(Interface): pass ... >>> >>> i = I1.interfaces() >>> i.next().getName() 'I1' >>> list(i) [] |
isEqualOrExtendedBy(self, other)Same interface or extends? |
names(self, all=False)Return the attribute names defined by the interface. |
namesAndDescriptions(self, all=False)Return attribute names and descriptions defined by interface. |
validateInvariants(self, obj, errors=None)validate object to defined invariants. |
Class Variable Details |
---|
__implemented__
|
__provides__
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 12:01:20 2005 | http://epydoc.sf.net |