Home | Trees | Indices | Help |
|
---|
|
This file is part of web2py Web Framework (Copyrighted, 2007-2010). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>. License: GPL v2
Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE
|
|||
Validator Root for all validators, mainly for documentation purposes. |
|||
IS_MATCH example: |
|||
IS_EXPR example: |
|||
IS_LENGTH Checks if length of field's value fits between given boundaries. |
|||
IS_IN_SET example: |
|||
IS_IN_DB example: |
|||
IS_NOT_IN_DB example: |
|||
IS_INT_IN_RANGE example: |
|||
IS_FLOAT_IN_RANGE example: |
|||
IS_DECIMAL_IN_RANGE example: |
|||
IS_NOT_EMPTY example: |
|||
IS_ALPHANUMERIC example: |
|||
IS_EMAIL Checks if field's value is a valid email address. |
|||
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: |
|||
IS_DATE example: |
|||
IS_DATETIME example: |
|||
IS_DATE_IN_RANGE | |||
IS_DATETIME_IN_RANGE | |||
IS_LIST_OF | |||
IS_LOWER convert to lower case |
|||
IS_UPPER convert to upper case |
|||
IS_SLUG convert arbitrary text string to a slug |
|||
IS_EMPTY_OR dummy class for testing IS_EMPTY_OR |
|||
IS_NULL_OR dummy class for testing IS_EMPTY_OR |
|||
CLEANUP example: |
|||
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. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
regex1 = re.compile(r'
|
|||
regex2 = re.compile(r'%\(
|
|||
official_url_schemes =
|
|||
unofficial_url_schemes =
|
|||
all_url_schemes =
|
|||
http_schemes =
|
|||
url_split_regex = re.compile(r'^
|
|||
label_split_regex = re.compile(r'
|
|||
official_top_level_domains =
|
|||
regex_time = re.compile(r'
|
|
Converts a unicode string into US-ASCII, using a simple conversion scheme. Each unicode character that does not have a US-ASCII equivalent is converted into a URL escaped form based on its hexadecimal value. For example, the unicode character '\u4e86' will become the string '%4e%86' :param string: unicode string, the unicode string to convert into an escaped US-ASCII form :returns: the US-ASCII escaped form of the inputted string :rtype: string @author: Jonathan Benn |
Follows the steps in RFC 3490, Section 4 to convert a unicode authority string into its ASCII equivalent. For example, u'www.Alliancefrançaise.nu' will be converted into 'www.xn--alliancefranaise-npb.nu' :param authority: unicode string, the URL authority component to convert, e.g. u'www.Alliancefrançaise.nu' :returns: the US-ASCII character equivalent to the inputed authority, e.g. 'www.xn--alliancefranaise-npb.nu' :rtype: string :raises Exception: if the function is not able to convert the inputed authority @author: Jonathan Benn |
Converts the inputed unicode url into a US-ASCII equivalent. This function goes a little beyond RFC 3490, which is limited in scope to the domain name (authority) only. Here, the functionality is expanded to what was observed on Wikipedia on 2009-Jan-22: Component Can Use Unicode? --------- ---------------- scheme No authority Yes path Yes query Yes fragment No The authority component gets converted to punycode, but occurrences of unicode in other components get converted into a pair of URI escapes (we assume 4-byte unicode). E.g. the unicode character U+4E2D will be converted into '%4E%2D'. Testing with Firefox v3.0.5 has shown that it can understand this kind of URI encoding. :param url: unicode string, the URL to convert from unicode into US-ASCII :param prepend_scheme: string, a protocol scheme to prepend to the URL if we're having trouble parsing it. e.g. "http". Input None to disable this functionality :returns: a US-ASCII equivalent of the inputed url :rtype: string @author: Jonathan Benn |
|
official_url_schemes
|
unofficial_url_schemes
|
all_url_schemes
|
url_split_regex
|
official_top_level_domains
|
regex_time
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Feb 3 10:53:18 2010 | http://epydoc.sourceforge.net |