Package zope :: Package configuration :: Module fields :: Class GlobalInterface
[show private | hide private]
[frames | no frames]

Type GlobalInterface

object --+                
         |                
   Element --+            
             |            
     Attribute --+        
                 |        
             Field --+    
                     |    
          GlobalObject --+
                         |
                        GlobalInterface

Known Subclasses:
DirectiveSchema

An interface that can be accessed from a module.

First, we need to set up a stub name resolver:

>>> class Foo(object): pass
>>> from zope.interface import Interface
>>> class IFoo(Interface): pass
>>> d = {'Foo': Foo, 'IFoo': IFoo}
>>> class fakeresolver(dict):
...     def resolve(self, n):
...         return self[n]
>>> fake = fakeresolver(d)

Now verify constraints are checked correctly.

>>> g = GlobalInterface()
>>> gg = g.bind(fake)
>>> gg.fromUnicode('IFoo')
<InterfaceClass zope.configuration.fields.IFoo>
>>> gg.fromUnicode('  IFoo  ')
<InterfaceClass zope.configuration.fields.IFoo>
>>> gg.fromUnicode('Foo')
Traceback (most recent call last):
...
WrongType: An interface is required

Method Summary
  __init__(self, **kw)
    Inherited from GlobalObject
  fromUnicode(self, u)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
Implements __implemented__ = <implementedBy zope.configuration.fiel...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy zope.configuration.fields.GlobalInterface>              

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb646d92c>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:24 2005 http://epydoc.sf.net