Attention

You are looking at outdated documentation for version 1.x. A newer version is available.

5.5.3.1.16. wsgidav.util

Miscellaneous support functions for WsgiDAV.

See Developers info for more information about the WsgiDAV architecture.

Functions

StringIO StringIO([s]) – Return a StringIO-like stream for reading or writing
addPropertyResponse(multistatusEL, href, …) Append <response> element to <multistatus> element.
byteNumberString(number[, thousandsSep, …]) Convert bytes into human-readable representation.
debug(msg[, var, module, flush]) Log if –debug.
evaluateHTTPConditionals(davres, …) Handle ‘If-…:’ headers (but not ‘If:’ header).
formatdate([timeval, localtime, usegmt]) Returns a date string as specified by RFC 2822, e.g.:
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)
getHttpStatusString(v) Return HTTP response string, e.g.
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.
log(msg[, var]) Shortcut for logging.getLogger(‘wsgidav’).info(msg)
lstripstr(s, prefix[, ignoreCase])
makeCompleteUrl(environ[, localUri]) URL reconstruction according to PEP 333.
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
note(msg[, var, module, flush]) Log if –verbose.
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.
parsedate(data)
pformat(object[, indent, width, depth]) Format a Python object into a pretty-printed representation.
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.
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.
status(msg[, var, module, flush]) Log if not –quiet.
stringRepr(s) Return a string as hex dump.
testIfHeaderDict(davres, dictIf, fullurl, …)
testLogging()
toUnicode(s) Convert a binary string to Unicode using UTF-8 (fallback to latin-1).
traceCall([msg]) Return name of calling function.
warn(msg[, var, module, flush]) Log to stderr.
write(msg[, var, module, flush]) Log always.
xmlToString(element[, pretty_print]) Wrapper for etree.tostring, that takes care of unsupported pretty_print option and prepends an encoding header.

Classes

SubAppStartResponse()

Exceptions

DAVError(statusCode[, contextinfo, …])