This file is part of the web2py Web Framework Copyrighted by Massimo
Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3
(http://www.gnu.org/licenses/lgpl.html)
|
Validator
Root for all validators, mainly for documentation purposes.
|
|
IS_MATCH
example:
|
|
IS_EQUAL_TO
example:
|
|
IS_EXPR
example:
|
|
IS_LENGTH
Checks if length of field's value fits between given boundaries.
|
|
IS_JSON
example:
|
|
IS_IN_SET
example:
|
|
IS_IN_DB
example:
|
|
IS_NOT_IN_DB
example:
|
|
IS_INT_IN_RANGE
Determine that the argument is (or can be represented as) an int,
and that it falls within the specified range.
|
|
IS_FLOAT_IN_RANGE
Determine that the argument is (or can be represented as) a float,
and that it falls within the specified inclusive range.
|
|
IS_DECIMAL_IN_RANGE
Determine that the argument is (or can be represented as) a Python
Decimal, and that it falls within the specified inclusive range.
|
|
IS_NOT_EMPTY
example:
|
|
IS_ALPHANUMERIC
example:
|
|
IS_EMAIL
Checks if field's value is a valid email address.
|
|
IS_LIST_OF_EMAILS
use as follows:...
|
|
IS_GENERIC_URL
Rejects a URL string if any of the following is true:
* The string is empty or None
* The string uses characters that are not allowed in a URL
* The URL scheme specified (if one is specified) is not valid
|
|
IS_HTTP_URL
Rejects a URL string if any of the following is true:
* The string is empty or None
* The string uses characters that are not allowed in a URL
* The string breaks any of the HTTP syntactic rules
* The URL scheme specified (if one is specified) is not 'http' or 'https'
* The top-level domain (if a host name is specified) does not exist
|
|
IS_URL
Rejects a URL string if any of the following is true:
* The string is empty or None
* The string uses characters that are not allowed in a URL
* The string breaks any of the HTTP syntactic rules
* The URL scheme specified (if one is specified) is not 'http' or 'https'
* The top-level domain (if a host name is specified) does not exist
|
|
IS_TIME
example:
|
|
UTC
UTC
|
|
IS_DATE
example:
|
|
IS_DATETIME
example:
|
|
IS_DATE_IN_RANGE
example:
|
|
IS_DATETIME_IN_RANGE
example:
|
|
IS_LIST_OF
|
|
IS_LOWER
convert to lower case
|
|
IS_UPPER
convert to upper case
|
|
IS_SLUG
convert arbitrary text string to a slug
|
|
ANY_OF
test if any of the validators in a list return successfully
|
|
IS_EMPTY_OR
dummy class for testing IS_EMPTY_OR
|
|
IS_NULL_OR
dummy class for testing IS_EMPTY_OR
|
|
CLEANUP
example:
|
|
LazyCrypt
Stores a lazy password hash
|
|
CRYPT
example::
|
|
IS_STRONG
example:
|
|
IS_IN_SUBSET
|
|
IS_IMAGE
Checks if file uploaded through file input was saved in one of
selected image formats and has dimensions (width and height) within
given boundaries.
|
|
IS_UPLOAD_FILENAME
Checks if name and extension of file uploaded through file input matches
given criteria.
|
|
IS_IPV4
Checks if field's value is an IP version 4 address in decimal form.
|
|
IS_IPV6
Checks if field's value is an IP version 6 address.
|
|
IS_IPADDRESS
Checks if field's value is an IP Address (v4 or v6).
|
|
|
|
|
|
range_error_message(error_message,
what_to_enter,
minimum,
maximum)
build the error message for the number range validators |
source code
|
|
|
|
|
is_empty(value,
empty_regex=None)
test empty field |
source code
|
|
|
|
|
|
|
|
|
urlify(s,
maxlen=80,
keep_underscores=False)
Convert incoming string to a simplified ASCII subset. |
source code
|
|
|
calc_entropy(string)
calculate a simple entropy for a given string |
source code
|
|
|
regex_isint = re.compile(r'^[ \+-] ? \d+ $')
|
|
JSONErrors = ( <type 'exceptions.NameError'>, <type 'exceptions...
|
|
have_current = True
|
|
regex1 = re.compile(r'\w+ \.\w+ ')
|
|
regex2 = re.compile(r'%\(( [^ \)] + ) \)\d* (?: \.\d+ ) ? [ a- zA- Z] ')
|
|
official_url_schemes = [ ' aaa ' , ' aaas ' , ' acap ' , ' cap ' , ' cid ' , ' ...
|
|
unofficial_url_schemes = [ ' about ' , ' adiumxtra ' , ' aim ' , ' afp ' , ...
|
|
all_url_schemes = [ None, ' aaa ' , ' aaas ' , ' acap ' , ' cap ' , ' cid ' , ...
|
|
http_schemes = [ None, ' http ' , ' https ' ]
|
|
url_split_regex = re.compile(r'^( ( [ ^ :/\?#] + ) :) ? ( //( [ ^ /\?#] * ) ) ? ...
|
|
label_split_regex = re.compile(r'[ \.\u3002\uff0e\uff61] ')
|
|
official_top_level_domains = [ ' ac ' , ' ad ' , ' ae ' , ' aero ' , ' af ' , ...
|
|
regex_time = re.compile(r'( (?P< h > [ 0- 9] + ) ) ( [ ^ 0- 9 ] + (?P< m > [ 0- 9 ] ...
|
|
utc = UTC()
|
|
lowerset = frozenset([ u' a ' , u' b ' , u' c ' , u' d ' , u' e ' , u' f ' , u' g ' ...
|
|
upperset = frozenset([ u' A ' , u' B ' , u' C ' , u' D ' , u' E ' , u' F ' , u' G ' ...
|
|
numberset = frozenset([ u' 0 ' , u' 1 ' , u' 2 ' , u' 3 ' , u' 4 ' , u' 5 ' , u' 6 ...
|
|
sym1set = frozenset([ u' ! ' , u' # ' , u' $ ' , u' % ' , u' & ' , u' ( ' , u' ) ' , ...
|
|
sym2set = frozenset([ u' " ' , u' ' ' , u' + ' , u' , ' , u' - ' , u' . ' , u' / ' , ...
|
|
otherset = frozenset([ u' 0 ' , u' 1 ' , u' 2 ' , u' 3 ' , u' 4 ' , u' 5 ' , u' 6 ' ...
|
|
__package__ = ' gluon '
|