Latest Version: 0.9.6.2

PlainText

Test that the field contains only letters, numbers, underscore, and the hyphen. Subclasses Regex.

Examples:

>>> PlainText.to_python('_this9_')
'_this9_'
>>> PlainText.from_python('  this  ')
'  this  '
>>> PlainText(accept_python=False).from_python('  this  ')
Traceback (most recent call last):
  ...
Invalid: Enter only letters, numbers, or _ (underscore)
>>> PlainText(strip=True).to_python('  this  ')
'this'
>>> PlainText(strip=True).from_python('  this  ')
'this'

Messages

badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
invalid:
Enter only letters, numbers, or _ (underscore)
noneType:
The input must be a string (not None)

Attributes

a __singletonmethods__

('to_python', 'from_python')

a __unpackargs__

('regex',)

a accept_python

True

a compound

False

a not_empty

False

a regex

'^[a-zA-Z_\\-0-9]*$'

a regexOps

()

a repeating

False

a strip

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 validate_python(self, value, state) ...

See the source for more information.

Top