wsgidav.util¶
Description
Miscellaneous support functions for WsgiDAV.
Classes
SubAppStartResponse () |
Functions
add_property_response (multistatusEL, href, …) |
Append <response> element to <multistatus> element. |
byte_number_string (number[, thousandsSep, …]) |
Convert bytes into human-readable representation. |
calc_base64 (s) |
Return base64 encoded binarystring. |
calc_hexdigest (s) |
Return md5 digest for a string. |
deep_update (d, u) |
|
dynamic_import_class (name) |
Import a class from a module string, e.g. |
dynamic_instantiate_middleware (name, args[, …]) |
Import a class and instantiate with custom args. |
evaluate_http_conditionals (dav_res, …) |
Handle ‘If-…:’ headers (but not ‘If:’ header). |
fail (value[, context_info, src_exception, …]) |
Wrapper to raise (and log) DAVError. |
get_content_length (environ) |
Return a positive CONTENT_LENGTH in a safe way (return 0 otherwise). |
get_etag (file_path) |
Return a strong Entity Tag for a (file)path. |
get_file_extension (path) |
|
get_log_time ([secs]) |
Return <secs> in log time format (pass secs=None for current date). |
get_module_logger (moduleName[, defaultToVerbose]) |
Create a module logger, that can be en/disabled by configuration. |
get_rfc1123_time ([secs]) |
Return <secs> in rfc 1123 date/time format (pass secs=None for current date). |
get_rfc3339_time ([secs]) |
Return <secs> in RFC 3339 date/time format (pass secs=None for current date). |
get_uri_name (uri) |
Return local name, i.e. |
get_uri_parent (uri) |
Return URI of parent collection with trailing ‘/’, or None, if URI is top-level. |
guess_mime_type (url) |
Use the mimetypes module to lookup the type for an extension. |
init_logging (config) |
Initialize base logger named ‘wsgidav’. |
is_child_uri (parentUri, childUri) |
Return True, if childUri is a child of parentUri. |
is_equal_or_child_uri (parentUri, childUri) |
Return True, if childUri is a child of parentUri or maps to the same resource. |
join_uri (uri, *segments) |
Append segments to URI. |
lstripstr (s, prefix[, ignoreCase]) |
|
make_complete_url (environ[, localUri]) |
URL reconstruction according to PEP 333. |
obtain_content_ranges (rangetext, filesize) |
returns tuple (list, value) |
parse_if_header_dict (environ) |
Parse HTTP_IF header into a dictionary and lists, and cache the result. |
parse_time_string (timestring) |
Return the number of seconds since the epoch, for a date/time string. |
parse_xml_body (environ[, allow_empty]) |
Read request body XML into an etree.Element. |
pop_path (path) |
Return ‘/a/b/c’ -> (‘a’, ‘/b/c’). |
pop_path2 (path) |
Return ‘/a/b/c’ -> (‘a’, ‘b’, ‘/c’). |
read_and_discard_input (environ) |
Read 1 byte from wsgi.input, if this has not been done yet. |
read_timeout_value_header (timeoutvalue) |
Return -1 if infinite, else return numofsecs. |
safe_re_encode (s, encoding_to[, errors]) |
Re-encode str or binary so that is compatible with a given encoding (replacing unsupported chars). |
save_split (s, sep, maxsplit) |
Split string, always returning n-tuple (filled with None if necessary). |
send_multi_status_response (environ, …) |
|
send_status_response (environ, start_response, e) |
Start a WSGI response for a DAVError or status code. |
shift_path (script_name, path_info) |
Return (‘/a’, ‘/b/c’) -> (‘b’, ‘/a/b’, ‘c’). |
split_namespace (clarkName) |
Return (namespace, localname) tuple for a property name in Clark Notation. |
string_repr (s) |
Return a string as hex dump. |
test_if_header_dict (dav_res, dictIf, …) |
|
to_unicode_safe (s) |
Convert a binary string to Unicode using UTF-8 (fallback to ISO-8859-1). |
Other Members
BASE_LOGGER_NAME |
The base logger (silent by default) |
DAVError (status_code[, context_info, …]) |
General error class that is used to signal HTTP and WEBDAV errors. |
HTTP_BAD_REQUEST |
int([x]) -> integer int(x, base=10) -> integer |
HTTP_CREATED |
int([x]) -> integer int(x, base=10) -> integer |
HTTP_NOT_MODIFIED |
int([x]) -> integer int(x, base=10) -> integer |
HTTP_NO_CONTENT |
int([x]) -> integer int(x, base=10) -> integer |
HTTP_OK |
int([x]) -> integer int(x, base=10) -> integer |
HTTP_PRECONDITION_FAILED |
int([x]) -> integer int(x, base=10) -> integer |
MAX_FINITE_TIMEOUT_LIMIT |
any numofsecs above the following limit is regarded as infinite |
PYTHON_VERSION |
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
as_DAVError (e) |
Convert any non-DAVError exception to HTTP_INTERNAL_ERROR. |
calendar |
Calendar printing functions |
compat |
Tool functions to support Python 2 and 3. |
etree |
Defused xml.etree.ElementTree facade |
formatdate ([timeval, localtime, usegmt]) |
Returns a date string as specified by RFC 2822, e.g.: |
get_http_status_string (v) |
Return HTTP response string, e.g. |
is_etree_element (obj) |
|
logging |
Logging package for Python. |
make_sub_element (parent, tag[, nsmap]) |
Wrapper for etree.SubElement, that takes care of unsupported nsmap option. |
md5 |
Returns a md5 hash object; optionally initialized with a string |
mimetypes |
Guess the MIME type of a file. |
os |
OS routines for NT or Posix depending on what system we’re on. |
parsedate (data) |
Convert a time string to a time tuple. |
pformat (object[, indent, width, depth, …]) |
Format a Python object into a pretty-printed representation. |
re |
Support for regular expressions (RE). |
reByteRangeSpecifier |
Compiled regular expression object. |
reIfHeader |
Compiled regular expression object. |
reIfSeparator |
Compiled regular expression object. |
reIfTagList |
Compiled regular expression object. |
reIfTagListContents |
Compiled regular expression object. |
reSecondsReader |
Compiled regular expression object. |
reSuffixByteRangeSpecifier |
Compiled regular expression object. |
socket |
This module provides socket operations and some related functions. |
stat |
Constants/functions for interpreting results of os.stat() and os.lstat(). |
sys |
This module provides access to some objects used or maintained by the interpreter and to functions that interact strongly with the interpreter. |
time |
This module provides various functions to manipulate time values. |
xml_to_bytes (element[, pretty_print]) |
Wrapper for etree.tostring, that takes care of unsupported pretty_print option and prepends an encoding header. |