OPSI.web2.dav.element.base module

WebDAV XML base classes.

This module provides XML utilities for use with WebDAV.

See RFC 2518: http://www.ietf.org/rfc/rfc2518.txt (WebDAV)

class OPSI.web2.dav.element.base.WebDAVElement(*children, **attributes)

Bases: object

WebDAV XML element. (RFC 2518, section 12)

addToDOM(document, parent)
allowed_attributes = None
allowed_children = None
childOfType(child_type)

Returns a child of the given type, if any, or None. Raises ValueError if more than one is found.

childrenOfType(child_type)

Returns a list of children with the same qname as the given type.

element(document)
emptyCopy()
hidden = False
name = None
namespace = 'DAV:'
protected = False
classmethod qname()
removeWhitespaceNodes()

Removes all of the whitespace-only text decendants of a DOM node.

classmethod sname()
toxml()
unregistered = False
validate()
writeAttributeToStream(output, name, value)
writeToStream(output, ns, level, pretty)

Fast XML output.

@param output: C{stream} to write to. @param ns: C{str} containing the namespace of the enclosing element. @param level: C{int} containing the element nesting level (starts at 0). @param pretty: C{bool} whether to use ‘pretty’ formatted output or not.

writeXML(output)
class OPSI.web2.dav.element.base.PCDATAElement(data)

Bases: object

addToDOM(document, parent)
element(document)
isWhitespace()
classmethod qname()
classmethod sname()
validate()
writeToStream(output, ns, level, pretty)
class OPSI.web2.dav.element.base.WebDAVOneShotElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVElement

Element with exactly one WebDAVEmptyElement child and no attributes.

class OPSI.web2.dav.element.base.WebDAVUnknownElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVElement

Placeholder for unknown element tag names.

allowed_children = {<class 'OPSI.web2.dav.element.base.PCDATAElement'>: (0, None), <class 'OPSI.web2.dav.element.base.WebDAVElement'>: (0, None)}
emptyCopy()
qname()
sname()
class OPSI.web2.dav.element.base.WebDAVEmptyElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVElement

WebDAV element with no contents.

allowed_children = {}
children = ()
class OPSI.web2.dav.element.base.WebDAVTextElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVElement

WebDAV element containing PCDATA.

allowed_children = {<class 'OPSI.web2.dav.element.base.PCDATAElement'>: (0, None)}
classmethod fromString(clazz, string)
class OPSI.web2.dav.element.base.WebDAVDateTimeElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVTextElement

WebDAV date-time element. (RFC 2518, section 23.2)

datetime()
classmethod fromDate(clazz, date)

date may be a datetime.datetime instance, a POSIX timestamp (integer value, such as returned by time.time()), or an ISO 8601-formatted (eg. “2005-06-13T16:14:11Z”) date/time string.

class OPSI.web2.dav.element.base.DateTimeHeaderElement(*children, **attributes)

Bases: OPSI.web2.dav.element.base.WebDAVTextElement

WebDAV date-time element for elements that substitute for HTTP headers. (RFC 2068, section 3.3.1)

datetime()
classmethod fromDate(clazz, date)

date may be a datetime.datetime instance, a POSIX timestamp (integer value, such as returned by time.time()), or an RFC 2068 Full Date (eg. “Mon, 23 May 2005 04:52:22 GMT”) string.