module documentation

Undocumented

Exception DjangoUnicodeDecodeError Undocumented
Function escape_uri_path Escape the unsafe characters from the path portion of a Uniform Resource Identifier (URI).
Function filepath_to_uri Convert a file system path to a URI portion that is suitable for inclusion in a URL.
Function force_bytes Similar to smart_bytes, except that lazy instances are resolved to strings, rather than kept as lazy objects.
Function force_str Similar to smart_str(), except that lazy instances are resolved to strings, rather than kept as lazy objects.
Function get_system_encoding The encoding for the character type functions. Fallback to 'ascii' if the #encoding is unsupported by Python or could not be determined. See tickets #10335 and #5846.
Function iri_to_uri Convert an Internationalized Resource Identifier (IRI) portion to a URI portion that is suitable for inclusion in a URL.
Function is_protected_type Determine if the object instance is of a protected type.
Function punycode Return the Punycode of the given domain if it's non-ASCII.
Function repercent_broken_unicode As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, repercent-encode any octet produced that is not part of a strictly legal UTF-8 octet sequence.
Function smart_bytes Return a bytestring version of 's', encoded as specified in 'encoding'.
Function smart_str Return a string representing 's'. Treat bytestrings using the 'encoding' codec.
Function uri_to_iri Convert a Uniform Resource Identifier(URI) into an Internationalized Resource Identifier(IRI).
Constant DEFAULT_LOCALE_ENCODING Undocumented
Constant _PROTECTED_TYPES Undocumented
Variable _ascii_ranges Undocumented
Variable _hexdig Undocumented
Variable _hextobyte Undocumented
def escape_uri_path(path): (source)

Escape the unsafe characters from the path portion of a Uniform Resource Identifier (URI).

def filepath_to_uri(path): (source)

Convert a file system path to a URI portion that is suitable for inclusion in a URL. Encode certain chars that would normally be recognized as special chars for URIs. Do not encode the ' character, as it is a valid character within URIs. See the encodeURIComponent() JavaScript function for details.

def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'): (source)

Similar to smart_bytes, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects.

def force_str(s, encoding='utf-8', strings_only=False, errors='strict'): (source)

Similar to smart_str(), except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects.

def get_system_encoding(): (source)

The encoding for the character type functions. Fallback to 'ascii' if the #encoding is unsupported by Python or could not be determined. See tickets #10335 and #5846.

def iri_to_uri(iri): (source)

Convert an Internationalized Resource Identifier (IRI) portion to a URI portion that is suitable for inclusion in a URL. This is the algorithm from section 3.1 of RFC 3987, slightly simplified since the input is assumed to be a string rather than an arbitrary byte stream. Take an IRI (string or UTF-8 bytes, e.g. '/I ♥ Django/' or b'/I ♥ Django/') and return a string containing the encoded result with ASCII chars only (e.g. '/I%20%E2%99%A5%20Django/').

def is_protected_type(obj): (source)

Determine if the object instance is of a protected type. Objects of protected types are preserved as-is when passed to force_str(strings_only=True).

def punycode(domain): (source)

Return the Punycode of the given domain if it's non-ASCII.

def repercent_broken_unicode(path): (source)

As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, repercent-encode any octet produced that is not part of a strictly legal UTF-8 octet sequence.

def smart_bytes(s, encoding='utf-8', strings_only=False, errors='strict'): (source)

Return a bytestring version of 's', encoded as specified in 'encoding'. If strings_only is True, don't convert (some) non-string-like objects.

def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'): (source)

Return a string representing 's'. Treat bytestrings using the 'encoding' codec. If strings_only is True, don't convert (some) non-string-like objects.

def uri_to_iri(uri): (source)

Convert a Uniform Resource Identifier(URI) into an Internationalized Resource Identifier(IRI). This is the algorithm from section 3.2 of RFC 3987, excluding step 4. Take an URI in ASCII bytes (e.g. '/I%20%E2%99%A5%20Django/') and return a string containing the encoded result (e.g. '/I%20♥%20Django/').

DEFAULT_LOCALE_ENCODING = (source)

Undocumented

Value
get_system_encoding()
_ascii_ranges = (source)

Undocumented

Undocumented

_hextobyte = (source)

Undocumented