Server IP : 127.0.0.2 / Your IP : 18.117.9.230 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/pywebdav/lib/ |
Upload File : |
from propfind import PROPFIND from xml.dom import minidom domimpl = minidom.getDOMImplementation() from utils import get_parenturi class REPORT(PROPFIND): def __init__(self, uri, dataclass, depth, body): PROPFIND.__init__(self, uri, dataclass, depth, body) doc = minidom.parseString(body) self.filter = doc.documentElement def create_propname(self): """ create a multistatus response for the prop names """ dc=self._dataclass # create the document generator doc = domimpl.createDocument(None, "multistatus", None) ms = doc.documentElement ms.setAttribute("xmlns:D", "DAV:") ms.tagName = 'D:multistatus' if self._depth=="0": if self._uri in self._dataclass.get_childs(get_parenturi(self._uri), self.filter): pnames=dc.get_propnames(self._uri) re=self.mk_propname_response(self._uri,pnames, doc) ms.appendChild(re) elif self._depth=="1": if self._uri in self._dataclass.get_childs(get_parenturi(self._uri), self.filter): pnames=dc.get_propnames(self._uri) re=self.mk_propname_response(self._uri,pnames, doc) ms.appendChild(re) for newuri in dc.get_childs(self._uri, self.filter): pnames=dc.get_propnames(newuri) re=self.mk_propname_response(newuri,pnames, doc) ms.appendChild(re) elif self._depth=='infinity': uri_list = [self._uri] while uri_list: uri = uri_list.pop() if uri in self._dataclass.get_childs(get_parenturi(uri), self.filter): pnames=dc.get_propnames(uri) re=self.mk_propname_response(uri,pnames, doc) ms.appendChild(re) uri_childs = self._dataclass.get_childs(uri) if uri_childs: uri_list.extend(uri_childs) return doc.toxml(encoding="utf-8") def create_prop(self): """ handle a <prop> request This will 1. set up the <multistatus>-Framework 2. read the property values for each URI (which is dependant on the Depth header) This is done by the get_propvalues() method. 3. For each URI call the append_result() method to append the actual <result>-Tag to the result document. We differ between "good" properties, which have been assigned a value by the interface class and "bad" properties, which resulted in an error, either 404 (Not Found) or 403 (Forbidden). """ # create the document generator doc = domimpl.createDocument(None, "multistatus", None) ms = doc.documentElement ms.setAttribute("xmlns:D", "DAV:") ms.tagName = 'D:multistatus' if self._depth=="0": if self._uri in self._dataclass.get_childs(get_parenturi(self._uri), self.filter): gp,bp=self.get_propvalues(self._uri) res=self.mk_prop_response(self._uri,gp,bp,doc) ms.appendChild(res) elif self._depth=="1": if self._uri in self._dataclass.get_childs(get_parenturi(self._uri), self.filter): gp,bp=self.get_propvalues(self._uri) res=self.mk_prop_response(self._uri,gp,bp,doc) ms.appendChild(res) for newuri in self._dataclass.get_childs(self._uri, self.filter): gp,bp=self.get_propvalues(newuri) res=self.mk_prop_response(newuri,gp,bp,doc) ms.appendChild(res) elif self._depth=='infinity': uri_list = [self._uri] while uri_list: uri = uri_list.pop() if uri in self._dataclass.get_childs(get_parenturi(uri), self.filter): gp,bp=self.get_propvalues(uri) res=self.mk_prop_response(uri,gp,bp,doc) ms.appendChild(res) uri_childs = self._dataclass.get_childs(uri) if uri_childs: uri_list.extend(uri_childs) return doc.toxml(encoding="utf-8")