Attention
You are looking at outdated documentation for version 2.x. A newer version is available.
wsgidav.util¶
Description
Miscellaneous support functions for WsgiDAV.
Classes
SubAppStartResponse () |
Functions
addPropertyResponse (multistatusEL, href, …) |
Append <response> element to <multistatus> element. |
byteNumberString (number[, thousandsSep, …]) |
Convert bytes into human-readable representation. |
calc_base64 (s) |
Return base64 encoded binarystring. |
calc_hexdigest (s) |
Return md5 digest for a string. |
evaluateHTTPConditionals (davres, …) |
Handle ‘If-…:’ headers (but not ‘If:’ header). |
fail (value[, contextinfo, srcexception, …]) |
Wrapper to raise (and log) DAVError. |
getContentLength (environ) |
Return a positive CONTENT_LENGTH in a safe way (return 0 otherwise). |
getETag (filePath) |
Return a strong Entity Tag for a (file)path. |
getFileExtension (path) |
|
getLogTime ([secs]) |
Return <secs> in log time format (pass secs=None for current date). |
getModuleLogger (moduleName[, defaultToVerbose]) |
Create a module logger, that can be en/disabled by configuration. |
getRfc1123Time ([secs]) |
Return <secs> in rfc 1123 date/time format (pass secs=None for current date). |
getRfc3339Time ([secs]) |
Return <secs> in RFC 3339 date/time format (pass secs=None for current date). |
getUriName (uri) |
Return local name, i.e. |
getUriParent (uri) |
Return URI of parent collection with trailing ‘/’, or None, if URI is top-level. |
guessMimeType (url) |
Use the mimetypes module to lookup the type for an extension. |
initLogging ([verbose, enable_loggers]) |
Initialize base logger named ‘wsgidav’. |
isChildUri (parentUri, childUri) |
Return True, if childUri is a child of parentUri. |
isEqualOrChildUri (parentUri, childUri) |
Return True, if childUri is a child of parentUri or maps to the same resource. |
joinUri (uri, *segments) |
Append segments to URI. |
lstripstr (s, prefix[, ignoreCase]) |
|
makeCompleteUrl (environ[, localUri]) |
URL reconstruction according to PEP 333. |
obtainContentRanges (rangetext, filesize) |
returns tuple (list, value) |
parseIfHeaderDict (environ) |
Parse HTTP_IF header into a dictionary and lists, and cache the result. |
parseTimeString (timestring) |
Return the number of seconds since the epoch, for a date/time string. |
parseXmlBody (environ[, allowEmpty]) |
Read request body XML into an etree.Element. |
popPath (path) |
Return ‘/a/b/c’ -> (‘a’, ‘/b/c’). |
popPath2 (path) |
Return ‘/a/b/c’ -> (‘a’, ‘b’, ‘/c’). |
readAndDiscardInput (environ) |
Read 1 byte from wsgi.input, if this has not been done yet. |
readTimeoutValueHeader (timeoutvalue) |
Return -1 if infinite, else return numofsecs. |
safeReEncode (s, encoding_to[, errors]) |
Re-encode str or binary so that is compatible with a given encoding (replacing unsupported chars). |
saveSplit (s, sep, maxsplit) |
Split string, always returning n-tuple (filled with None if necessary). |
sendMultiStatusResponse (environ, …) |
|
sendStatusResponse (environ, start_response, e) |
Start a WSGI response for a DAVError or status code. |
shiftPath (scriptName, pathInfo) |
Return (‘/a’, ‘/b/c’) -> (‘b’, ‘/a/b’, ‘c’). |
splitNamespace (clarkName) |
Return (namespace, localname) tuple for a property name in Clark Notation. |
stringRepr (s) |
Return a string as hex dump. |
testIfHeaderDict (davres, dictIf, fullurl, …) |
|
toUnicode (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 (statusCode[, contextinfo, …]) |
General error class that is used to signal HTTP and WEBDAV errors. |
HTTP_BAD_REQUEST |
int(x=0) -> int or long int(x, base=10) -> int or long |
HTTP_CREATED |
int(x=0) -> int or long int(x, base=10) -> int or long |
HTTP_NOT_MODIFIED |
int(x=0) -> int or long int(x, base=10) -> int or long |
HTTP_NO_CONTENT |
int(x=0) -> int or long int(x, base=10) -> int or long |
HTTP_OK |
int(x=0) -> int or long int(x, base=10) -> int or long |
HTTP_PRECONDITION_FAILED |
int(x=0) -> int or long int(x, base=10) -> int or long |
MAX_FINITE_TIMEOUT_LIMIT |
any numofsecs above the following limit is regarded as infinite |
PYTHON_VERSION |
str(object=’‘) -> string |
asDAVError (e) |
Convert any non-DAVError exception to HTTP_INTERNAL_ERROR. |
base64 |
RFC 3548: Base16, Base32, Base64 Data Encodings |
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.: |
getHttpStatusString (v) |
Return HTTP response string, e.g. |
isEtreeElement (obj) |
|
locale |
Locale support module. |
logging |
Logging package for Python. |
makeSubElement (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) |
|
re |
Support for regular expressions (RE). |
reByteRangeSpecifier |
Compiled regular expression objects |
reIfHeader |
Compiled regular expression objects |
reIfSeparator |
Compiled regular expression objects |
reIfTagList |
Compiled regular expression objects |
reIfTagListContents |
Compiled regular expression objects |
reSecondsReader |
Compiled regular expression objects |
reSuffixByteRangeSpecifier |
Compiled regular expression objects |
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. |
xmlToBytes (element[, pretty_print]) |
Wrapper for etree.tostring, that takes care of unsupported pretty_print option and prepends an encoding header. |