PYME.cluster.webdav module

class PYME.cluster.webdav.BufWriter(w, debug=True)

Bases: object

flush()
getSize()
write(s)
class PYME.cluster.webdav.Collection(name)

Bases: Member

getMembers()
class PYME.cluster.webdav.DAVRequestHandler(request, client_address, server)

Bases: BaseHTTPRequestHandler

Auserlist = []
WebAuth()
all_props = ['name', 'parentname', 'href', 'ishidden', 'isreadonly', 'getcontenttype', 'contentclass', 'getcontentlanguage', 'creationdate', 'lastaccessed', 'getlastmodified', 'getcontentlength', 'iscollection', 'isstructureddocument', 'defaultdocument', 'displayname', 'isroot', 'resourcetype']
auth_enable = False
auth_file = False
basic_props = ['name', 'getcontenttype', 'getcontentlength', 'creationdate', 'iscollection']
do_COPY()
do_DELETE()
do_GET(onlyhead=False)
do_HEAD()
do_LOCK()
do_MKCOL()
do_MOVE()
do_OPTIONS()
do_PROPFIND()
do_PROPPATCH()
do_PUT()
do_UNLOCK()
log_message(format, *args)

Log an arbitrary message.

This is used by all other logging functions. Override it if you have specific logging wishes.

The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it’s just like printf!).

The client ip and current date/time are prefixed to every message.

Unicode control characters are replaced with escaped hex before writing the output to stderr.

path_elem()

Returns split path (see split_path()) and Member object of the last element

path_elem_prev()

Returns split path (see split_path()) and Member object of the next-to-last element

server_version = 'Pythonista_dav'
split_path(path)

Splits path string in form ‘/dir1/dir2/file’ into parts

class PYME.cluster.webdav.DAVServer(addr, handler, root, userpwd)

Bases: ThreadingMixIn, HTTPServer

finish_request(request, client_address)

Finish one request by instantiating RequestHandlerClass.

class PYME.cluster.webdav.DirCollection(fsdir, virdir, parent=None)

Bases: FileMember, Collection

COLLECTION_MIME_TYPE = 'httpd/unix-directory'
findMember(name)

Search for a particular member.

getMembers()

Get immediate members of this collection.

getProperties()

Return dictionary with WebDAV properties. Values shold be formatted according to the WebDAV specs.

recvMember(rfile, name, size, req)

Receive (save) a member file

rootdir()
sendData(wfile)

Send “file” to the client. Since this is a directory, build some arbitrary HTML.

class PYME.cluster.webdav.DummyFileMember(name, parent)

Bases: FileMember

getProperties()

Return dictionary with WebDAV properties. Values shold be formatted according to the WebDAV specs.

class PYME.cluster.webdav.FileMember(name, parent)

Bases: Member

getProperties()

Return dictionary with WebDAV properties. Values shold be formatted according to the WebDAV specs.

sendData(wfile, bpoint=0, epoint=0)

Send the file to the client. Literally.

class PYME.cluster.webdav.Member

Bases: object

M_COLLECTION = 2
M_MEMBER = 1
getProperties()
class PYME.cluster.webdav.Tag(name, attrs, data='', parser=None)

Bases: object

addChild(tag)

Adds a child to self. tag must be instance of Tag

class PYME.cluster.webdav.TempDirCollection(fsdir, virdir, parent=None)

Bases: DirCollection

Temporary directories do not exist on disk. They are held in memory on the server to provide a mechanism for creating new directories with the create + rename/move mechanism used by most OSs

findMember(name)

Search for a particular member.

getMembers()

Get immediate members of this collection.

getProperties()

Return dictionary with WebDAV properties. Values shold be formatted according to the WebDAV specs.

recvMember(rfile, name, size, req)

Receive (save) a member file

class PYME.cluster.webdav.XMLDict_Parser(xml)

Bases: object

builddict()

Builds a nested-dictionary-like structure from the xml. This method picks up tags on the main level and calls processTag() for nested tags.

getnexttag()
processTag(dtag)

Process single tag’s data

PYME.cluster.webdav.builddict(xml)

Wrapper function for straightforward parsing

PYME.cluster.webdav.get_localip()
PYME.cluster.webdav.main()
PYME.cluster.webdav.makedirs_safe(dir)

A safe wrapper for makedirs, which won’t throw an error if the directory already exists. This replicates the functionality of the exists_ok flag in the python 3 version of os.makedirs, but should work with both pytion 2 and python 3.

Parameters
dirstr, directory to be created
Returns
PYME.cluster.webdav.splitattrs(att)

Extracts name=”value” pairs from string; returns them as dictionary

PYME.cluster.webdav.unixdate2httpdate(d)
PYME.cluster.webdav.unixdate2iso8601(d)