Index of the formencode module
-
m
formencode
...
-
a
Identity
...
-
m
htmlgen
...
- Kind of like htmlgen, only much simpler. The only important symbol
that is exported is html.
-
m
variabledecode
...
- Takes GET/POST variable dictionary, as might be returned by cgi,
and turns them into lists and dictionaries.
-
m
doctest_xml_compare
...
-
m
api
...
- Core classes for validation.
-
C
NoDefault
...
-
C
Invalid
...
- This is raised in response to invalid input. It has several
public attributes:
-
C
FancyValidator
...
- FancyValidator is the (abstract) superclass for various validators
and converters. A subclass can validate, convert, or do both.
There is no formal distinction made here.
-
C
Validator
...
- The base class of most validators. See IValidator for more, and
FancyValidator for the more common (and more featureful) class.
-
a
declarative_count
...
-
f
subvalidators
...
- Return any validators that this validator contains. This is
not useful for functional, except to inspect what values are
available. Specifically the .all_messages() method uses
this to accumulate all possible messages.
-
f
all_messages
...
- Return a dictionary of all the messages of this validator, and
any subvalidators if present. Keys are message names, values
may be a message or list of messages. This is really just
intended for documentation purposes, to show someone all the
messages that a validator or compound validator (like Schemas)
can produce.
-
f
message
...
-
f
__init__
...
-
f
to_python
...
-
f
from_python
...
-
f
is_validator
...
-
m
validators
...
- Validator/Converters for use with FormEncode.
-
C
Regex
...
- Invalid if the value doesn't match the regular expression regex.
-
C
OneOf
...
- Tests that the value is one of the members of a given list.
-
C
TimeConverter
...
- Converts times in the format HH:MM:SSampm to (h, m, s).
Seconds are optional.
-
C
PlainText
...
- Test that the field contains only letters, numbers, underscore,
and the hyphen. Subclasses Regex.
-
C
ConfirmType
...
- Confirms that the input/output is of the proper type.
-
C
Bool
...
- Always Valid, returns True or False based on the value and the
existance of the value.
-
C
DateValidator
...
- Validates that a date is within the given range. Be sure to call
DateConverter first if you aren't expecting mxDateTime input.
-
C
Email
...
- Validate an email address.
-
C
Empty
...
- Invalid unless the value is empty. Use cleverly, if at all.
-
C
FieldStorageUploadConverter
...
- Converts a cgi.FieldStorage instance to
a value that FormEncode can use for file
uploads.
-
C
String
...
- Converts things to string, but treats empty things as the empty
string.
-
C
CreditCardSecurityCode
...
- Checks that credit card security code has the correct number
of digits for the given credit card type.
-
C
DictConverter
...
- Converts values based on a dictionary which has values as keys for
the resultant values.
-
C
StripField
...
- Take a field from a dictionary, removing the key from the
dictionary.
-
C
FieldsMatch
...
- Tests that the given fields match, i.e., are identical. Useful
for password+confirmation fields. Pass the list of field names in
as field_names.
-
C
CreditCardValidator
...
- Checks that credit card numbers are valid (if not real).
-
C
Number
...
- Convert a value to a float or integer. Tries to convert it to
an integer if no information is lost.
-
C
FormValidator
...
- A FormValidator is something that can be chained with a
Schema. Unlike normal chaining the FormValidator can
validate forms that aren't entirely valid.
-
C
RequireIfMissing
...
- Messages
-
C
DateConverter
...
- Validates and converts a string date, like mm/yy, dd/mm/yy,
dd-mm-yy, etc. Using month_style you can support
'mm/dd/yyyy' or 'dd/mm/yyyy'. Only these two general
styles are supported.
-
C
FileUploadKeeper
...
- Takes two inputs (a dictionary with keys static and
upload) and converts them into one value on the Python side (a
dictionary with filename and content keys). The upload
takes priority over the static value. The filename may be None if
it can't be discovered.
-
C
IPhoneNumberValidator
...
- Validates, and converts phone numbers to +##-###-#######.
Adapted from RFC 3966
-
C
URL
...
- Validate a URL, either http://... or https://. If check_exists
is true, then we'll actually make a request for the page.
-
C
StringBool
...
- Converts a string to a boolean.
-
C
CreditCardExpires
...
- Checks that credit card expiration date is valid relative to
the current date.
-
C
IndexListConverter
...
- Converts a index (which may be a string like '2') to the value in
the given list.
-
C
PhoneNumber
...
- Validates, and converts to ###-###-####, optionally with extension
(as ext.##...). Only support US phone numbers. See
InternationalPhoneNumber for support for that kind of phone number.
-
C
Wrapper
...
- Used to convert functions to validator/converters.
-
C
PostalCode
...
- US Postal codes (aka Zip Codes).
-
C
CIDR
...
- Formencode validator to check whether a string is in correct CIDR
notation (IP address, or IP address plus /mask)
-
C
StateProvince
...
- Valid state or province code (two-letter).
-
C
MACAddress
...
- Formencode validator to check whether a string is a correct hardware
(MAC) address.
-
C
Set
...
- This is for when you think you may return multiple values for a
certain field.
-
C
Constant
...
- This converter converts everything to the same thing.
-
C
NotEmpty
...
- Invalid if value is empty (empty string, empty list, etc).
-
C
Int
...
- Convert a value to an integer.
-
C
SignedString
...
- Encodes a string into a signed string, and base64 encodes both the
signature string and a random nonce.
-
C
MinLength
...
- Invalid if the value is shorter than minlength. Uses len(),
so it can work for strings, lists, or anything with length.
-
C
MaxLength
...
- Invalid if the value is longer than maxLength. Uses len(),
so it can work for strings, lists, or anything with length.
-
C
UnicodeString
...
- Converts things to unicode string, this is a specialization of
the String class.
-
m
foreach
...
- Validator for repeating items.
-
C
ForEach
...
- Use this to apply a validator/converter to each item in a list.
-
m
htmlfill_schemabuilder
...
- Extension to htmlfill that can parse out schema-defining
statements.
-
m
htmlfill
...
- Parser for HTML forms, that fills in defaults and errors. See
render.
-
C
htmlliteral
...
-
C
FillingParser
...
- Fills HTML with default values, as in a form.
-
f
default_formatter
...
- Formatter that escapes the error, wraps the error in a span with
class error-message, and adds a <br>
-
f
escape_formatter
...
- Formatter that escapes HTML, no more.
-
f
none_formatter
...
- Formatter that does nothing, no escaping HTML, nothin'
-
f
render
...
- Render the form (which should be a string) given the defaults
and errors. Defaults are the values that go in the input fields
(overwriting any values that are there) and errors are displayed
inline in the form (and also effect input classes). Returns the
rendered string.
-
m
interfaces
...
- Interfaces for FormEncode (for documentation purposes only)
-
C
Interface
...
-
C
Attribute
...
-
C
IValidator
...
-
a
messages
...
-
a
if_missing
...
-
a
compound
...
-
a
repeating
...
-
f
to_python
...
- Convert value from its foreign representation to its Python
representation. state is for application-specific hooks.
-
f
__init__
...
- Instantiates this class with all the keywords being used to
update the instance variables.
-
f
__call__
...
- Returns a copy with all attributes using the given keywords,
being updated.
-
f
message
...
- Return the message (from the messages attribute) that goes
with name, or return default if name not found default.
-
f
from_python
...
- Convert value from its Python representation to the foreign
representation. state is for application-specific hooks.
-
C
ISchema
...
-
a
fields
...
-
f
to_python
...
- Convert value from its foreign representation to its Python
representation. state is for application-specific hooks.
-
f
__init__
...
- Instantiates this class with all the keywords being used to
update the instance variables.
-
f
__call__
...
- Returns a copy with all attributes using the given keywords,
being updated.
-
f
message
...
- Return the message (from the messages attribute) that goes
with name, or return default if name not found default.
-
f
from_python
...
- Convert value from its Python representation to the foreign
representation. state is for application-specific hooks.
-
C
IDeclarative
...
-
f
__call__
...
- Returns a copy with all attributes using the given keywords,
being updated.
-
f
__init__
...
- Instantiates this class with all the keywords being used to
update the instance variables.
-
m
fieldstorage
...
- Wrapper class for use with cgi.FieldStorage types for file uploads
-
m
util
...
-
m
doctest24
...
- Module doctest -- a framework for running examples in docstrings.
-
a
__docformat__
...
-
a
ELLIPSIS
...
-
a
REPORT_CDIFF
...
-
a
DONT_ACCEPT_BLANKLINE
...
-
a
REPORT_ONLY_FIRST_FAILURE
...
-
a
REPORTING_FLAGS
...
-
a
REPORT_NDIFF
...
-
C
OutputChecker
...
- A class used to check the whether the actual output from a doctest
example matches the expected output. OutputChecker defines two
methods: check_output, which compares a given pair of outputs,
and returns true if they match; and output_difference, which
returns a string describing the differences between two outputs.
-
f
check_output
...
- Return True iff the actual output from an example (got)
matches the expected output (want). These strings are
always considered to match if they are identical; but
depending on what option flags the test runner is using,
several non-exact match types are also possible. See the
documentation for TestRunner for more information about
option flags.
-
f
output_difference
...
- Return a string describing the differences between the
expected output for a given example (example) and the actual
output (got). optionflags is the set of option flags used
to compare want and got.
-
C
DocTestFailure
...
- A DocTest example has failed in debugging mode.
-
C
Tester
...
-
C
DocTestRunner
...
- A class used to run DocTest test cases, and accumulate statistics.
The run method is used to process a single DocTest case. It
returns a tuple (f, t), where t is the number of test cases
tried, and f is the number of test cases that failed.
-
a
DIVIDER
...
-
f
report_unexpected_exception
...
- Report that the given example raised an unexpected exception.
-
f
run
...
- Run the examples in test, and display the results using the
writer function out.
-
f
report_start
...
- Report that the test runner is about to process the given
example. (Only displays a message if verbose=True)
-
f
merge
...
-
f
report_failure
...
- Report that the given example failed.
-
f
report_success
...
- Report that the given example ran successfully. (Only
displays a message if verbose=True)
-
f
summarize
...
- Print a summary of all the test cases that have been run by
this DocTestRunner, and return a tuple (f, t), where f is
the total number of failed examples, and t is the total
number of tried examples.
-
f
__init__
...
- Create a new test runner.
-
C
DocTest
...
- A collection of doctest examples that should be run in a single
namespace. Each DocTest defines the following attributes:
-
f
__init__
...
- Create a new DocTest containing the given examples. The
DocTest's globals are initialized with a copy of globs.
-
f
__cmp__
...
-
C
UnexpectedException
...
- A DocTest example has encountered an unexpected exception
-
C
Example
...
- A single doctest example, consisting of source code and expected
output. Example defines the following attributes:
-
C
DocTestParser
...
- A class used to parse strings containing doctest examples.
-
f
get_examples
...
- Extract all doctest examples from the given string, and return
them as a list of Example objects. Line numbers are
0-based, because it's most common in doctests that nothing
interesting appears on the same line as opening triple-quote,
and so the first interesting line is called "line 1" then.
-
f
get_doctest
...
- Extract all doctest examples from the given string, and
collect them into a DocTest object.
-
f
parse
...
- Divide the given string into examples and intervening text,
and return them as a list of alternating Examples and strings.
Line numbers for the Examples are 0-based. The optional
argument name is a name identifying this string, and is only
used for error messages.
-
C
DocTestFinder
...
- A class used to extract the DocTests that are relevant to a given
object, from its docstring and the docstrings of its contained
objects. Doctests can currently be extracted from the following
object types: modules, functions, classes, methods, staticmethods,
classmethods, and properties.
-
C
DebugRunner
...
- Run doc tests but raise an exception as soon as there is a failure.
-
f
report_unexpected_exception
...
-
f
run
...
-
f
report_start
...
- Report that the test runner is about to process the given
example. (Only displays a message if verbose=True)
-
f
merge
...
-
f
report_failure
...
-
f
report_success
...
- Report that the given example ran successfully. (Only
displays a message if verbose=True)
-
f
summarize
...
- Print a summary of all the test cases that have been run by
this DocTestRunner, and return a tuple (f, t), where f is
the total number of failed examples, and t is the total
number of tried examples.
-
f
__init__
...
- Create a new test runner.
-
f
testmod
...
-
- m=None, name=None, globs=None, verbose=None, isprivate=None,
- report=True, optionflags=0, extraglobs=None, raise_on_error=False,
exclude_empty=False
-
f
testsource
...
- Extract the test sources from a doctest docstring as a script.
-
f
set_unittest_reportflags
...
- Sets the unittest option flags.
-
f
testfile
...
- Test examples in the given file. Return (#failures, #tests).
-
f
DocFileSuite
...
- A unittest suite for one or more doctest files.
-
f
run_docstring_examples
...
- Test examples in the given object's docstring (f), using globs
as globals. Optional argument name is used in failure messages.
If the optional argument verbose is true, then generate output
even if there are no failures.
-
f
DocTestSuite
...
- Convert doctest tests for a module to a unittest test suite.
-
f
register_optionflag
...
-
f
debug_src
...
- Debug a single doctest docstring, in argument src'
-
f
is_private
...
- prefix, base -> true iff name prefix + "." + base is "private".
-
f
script_from_examples
...
- Extract script from text with examples.
-
f
debug
...
- Debug a single doctest docstring.
-
m
threadinglocal
...
-
m
compound
...
- Validators for applying validations in sequence.
-
C
All
...
- This class is like an 'and' operator for validators. All
validators must work, and the results are passed in turn through
all validators for conversion.
-
C
Any
...
- This class is like an 'or' operator for validators. The first
validator/converter that validates the value will be used. (You
can pass in lists of validators, which will be ANDed)
-
m
htmlform
...
- Class to encapsulate an HTML form, using htmlfill and
htmlfill_schemabuilder (deprecated).
-
m
declarative
...
- Declarative objects for FormEncode.
-
a
counter
...
-
a
generators
...
-
C
classinstancemethod
...
- Acts like a class method when called from a class, like an
instance method when called by an instance. The method should
take two arguments, 'self' and 'cls'; one of these will be None
depending on how the method was called.
-
C
DeclarativeMeta
...
-
C
singletonmethod
...
- For Declarative subclasses, this decorator will call the method
on the cls.singleton() object if called as a class method (or
as normal if called as an instance method).