Package gnue :: Package navigator :: Package external :: Package zope :: Package interface :: Module interface :: Class SpecificationBasePy
[show private | hide private]

Type SpecificationBasePy

object --+
         |
        SpecificationBasePy

Known Subclasses:
Specification

Method Summary
  implementedBy(self, cls)
Test whether the specification is implemented by a class or factory.
  isOrExtends(self, interface)
Is the interface the same as or extend the given interface
  providedBy(self, ob)
Is the interface implemented by an object
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Class Variable Summary
Implements __implemented__ = <implementedBy gnue.navigator.external...
ClassProvides __providedBy__ = <gnue.navigator.external.zope.interface...
ClassProvides __provides__ = <gnue.navigator.external.zope.interface.d...

Method Details

implementedBy(self, cls)

Test whether the specification is implemented by a class or factory. Raise TypeError if argument is neither a class nor a callable.

isOrExtends(self, interface)

Is the interface the same as or extend the given interface

Examples:
 >>> from gnue.navigator.external.zope.interface import Interface
 >>> from gnue.navigator.external.zope.interface.declarations import Declaration
 >>> class I1(Interface): pass
 ...
 >>> class I2(I1): pass
 ...
 >>> class I3(Interface): pass
 ...
 >>> class I4(I3): pass
 ...
 >>> spec = Declaration()
 >>> int(spec.extends(Interface))
 0
 >>> spec = Declaration(I2)
 >>> int(spec.extends(Interface))
 1
 >>> int(spec.extends(I1))
 1
 >>> int(spec.extends(I2))
 1
 >>> int(spec.extends(I3))
 0
 >>> int(spec.extends(I4))
 0

providedBy(self, ob)

Is the interface implemented by an object
>>> from gnue.navigator.external.zope.interface import *
>>> class I1(Interface):
...     pass
>>> class C(object):
...     implements(I1)
>>> c = C()
>>> class X(object):
...     pass
>>> x = X()
>>> I1.providedBy(x)
False

>>> I1.providedBy(C)
False

>>> I1.providedBy(c)
True

>>> directlyProvides(x, I1)
>>> I1.providedBy(x)
True

>>> directlyProvides(C, I1)
>>> I1.providedBy(C)
True

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy gnue.navigator.external.zope.interface.interface.Specif\
icationBasePy>                                                         

__providedBy__

Type:
ClassProvides
Value:
<gnue.navigator.external.zope.interface.declarations.ClassProvides obj\
ect at 0xb7b0094c>                                                     

__provides__

Type:
ClassProvides
Value:
<gnue.navigator.external.zope.interface.declarations.ClassProvides obj\
ect at 0xb7b0094c>                                                     


GNUe Home

Private API

Developer's Corner