wsgidav.dav_provider

Description

Abstract base class for DAV resource providers.

This module serves these purposes:

  1. Documentation of the DAVProvider interface
  2. Common base class for all DAV providers
  3. Default implementation for most functionality that a resource provider must deliver.

If no default implementation can be provided, then all write actions generate FORBIDDEN errors. Read requests generate NOT_IMPLEMENTED errors.

_DAVResource, DAVCollection, DAVNonCollection

Represents an existing (i.e. mapped) WebDAV resource or collection.

A _DAVResource object is created by a call to the DAVProvider.

The resource may then be used to query different attributes like res.name, res.is_collection, res.get_content_length(), and res.support_etag().

It also implements operations, that require an existing resource, like: get_preferred_path(), create_collection(), or get_property_value().

Usage:

res = provider.get_resource_inst(path, environ)
if res is not None:
    print(res.getName())

DAVProvider

A DAV provider represents a shared WebDAV system.

There is only one provider instance per share, which is created during server start-up. After that, the dispatcher (request_resolver.RequestResolver) parses the request URL and adds it to the WSGI environment, so it can be accessed like this:

provider = environ["wsgidav.provider"]

The main purpose of the provider is to create _DAVResource objects for URLs:

res = provider.get_resource_inst(path, environ)

Supporting Objects The DAVProvider takes two supporting objects:

propertyManager

An object that provides storage for dead properties assigned for webDAV resources.

PropertyManagers must provide the methods as described in wsgidav.interfaces.propertymanagerinterface

See prop_man.property_manager.PropertyManager for a sample implementation using shelve.

lockManager

An object that provides storage for locks made on webDAV resources.

LockManagers must provide the methods as described in wsgidav.interfaces.lockmanagerinterface

See lock_manager.LockManager for a sample implementation using shelve.

See reference_guide for more information about the WsgiDAV architecture.

Classes

DAVCollection(path, environ) A DAVCollection is a _DAVResource, that has members (like a ‘folder’ on a filesystem).
DAVNonCollection(path, environ) A DAVNonCollection is a _DAVResource, that has content (like a ‘file’ on a filesystem).
DAVProvider() Abstract base class for DAV resource providers.

Other Members

DAVError(status_code[, context_info, …]) General error class that is used to signal HTTP and WEBDAV errors.
HTTP_FORBIDDEN int([x]) -> integer int(x, base=10) -> integer
HTTP_NOT_FOUND int([x]) -> integer int(x, base=10) -> integer
PRECONDITION_CODE_ProtectedProperty str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
as_DAVError(e) Convert any non-DAVError exception to HTTP_INTERNAL_ERROR.
compat Tool functions to support Python 2 and 3.
etree Defused xml.etree.ElementTree facade
os OS routines for NT or Posix depending on what system we’re on.
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.
traceback Extract, format and print information about Python stack traces.
util Miscellaneous support functions for WsgiDAV.
xml_tools Small wrapper for different etree packages.