Latest Version: 0.9.6.2

Set

This is for when you think you may return multiple values for a certain field.

This way the result will always be a list, even if there's only one result. It's equivalent to ForEach(convertToList=True).

If you give use_set=True, then it will return an actual sets.Set object.

>>> Set.to_python(None)
[]
>>> Set.to_python('this')
['this']
>>> Set.to_python(('this', 'that'))
['this', 'that']
>>> s = Set(use_set=True)
>>> s.to_python(None)
Set([])
>>> s.to_python('this')
Set(['this'])
>>> s.to_python(('this',))
Set(['this'])

Messages

badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
noneType:
The input must be a string (not None)

Attributes

a __singletonmethods__

('to_python', 'from_python')

a accept_python

True

a compound

False

a if_missing

()

a not_empty

False

a repeating

False

a strip

False

a use_set

False

Methods

f __call__(self, *args, **kw) ...

f __classinit__(cls, new_attrs) ...

f __classsourcerepr__(cls, source, binding=None) ...

f __init__(self, *args, **kw) ...

f __initargs__(self, new_attrs) ...

f __sourcerepr__(self, source, binding=None) ...

f empty_value(self, value) ...

See the source for more information.

Top