Trees | Index | Help |
|
---|
Package zope :: Package configuration :: Module fields :: Class Tokens |
|
object
--+ |Element
--+ |Attribute
--+ |Field
--+ |Container
--+ |Iterable
--+ |object
--+ | | |MinMaxLen
--+ |AbstractCollection
--+ |List
--+ | Tokens
A list that can be read from a space-separated string
Consider GlobalObject tokens:
Examples:
First, we need to set up a stub name resolver:
>>> d = {'x': 1, 'y': 42, 'z': 'zope', 'x.y.x': 'foo'} >>> class fakeresolver(dict): ... def resolve(self, n): ... return self[n]
>>> fake = fakeresolver(d)
>>> g = Tokens(value_type=GlobalObject()) >>> gg = g.bind(fake) >>> gg.fromUnicode(" \n x y z \n") [1, 42, 'zope']
>>> g = Tokens(value_type= ... GlobalObject(value_type= ... schema.Int(constraint=lambda x: x%2 == 0))) >>> gg = g.bind(fake) >>> gg.fromUnicode("x y") Traceback (most recent call last): ... InvalidToken: 1 in x y
>>> gg.fromUnicode("z y") Traceback (most recent call last): ... InvalidToken: ('zope', (<type 'int'>, <type 'long'>)) in z y >>> gg.fromUnicode("y y") [42, 42] >>>
Method Summary | |
---|---|
fromUnicode(self,
u)
| |
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 | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
Implements |
__implemented__ = <implementedBy zope.configuration.fiel...
|
ClassProvides |
__provides__ = <zope.interface.declarations.ClassProvide...
|
Class Variable Details |
---|
__implemented__
|
__provides__
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 | http://epydoc.sf.net |