def getSelfHrefs(self, rurl): assert(isinstance(rurl, URL)) results = () # Create WebDAV principal-match request = PrincipalMatch(self, rurl.relativeURL(), (davxml.principal_URL,)) result = ResponseDataString() request.setOutput(result) # Process it self.runSession(request) # If its a 207 we want to parse the XML if request.getStatusCode() == statuscodes.MultiStatus: parser = PropFindParser() parser.parseData(result.getData()) # Look at each propfind result and extract any Hrefs for item in parser.getResults().itervalues(): # Get child element name (decode URL) name = URL(url=item.getResource(), decode=True) results += (name,) else: self.handleHTTPError(request) return None return results
def getSelfHrefs(self, rurl): assert (isinstance(rurl, URL)) results = () # Create WebDAV principal-match request = PrincipalMatch(self, rurl.relativeURL(), (davxml.principal_URL, )) result = ResponseDataString() request.setOutput(result) # Process it self.runSession(request) # If its a 207 we want to parse the XML if request.getStatusCode() == statuscodes.MultiStatus: parser = PropFindParser() parser.parseData(result.getData()) # Look at each propfind result and extract any Hrefs for item in parser.getResults().itervalues(): # Get child element name (decode URL) name = URL(url=item.getResource(), decode=True) results += (name, ) else: self.handleHTTPError(request) return None return results
def getSelfProperties(self, rurl, props): assert (isinstance(rurl, URL)) results = {} # Create WebDAV principal-match request = PrincipalMatch(self, rurl.relativeURL(), props) result = ResponseDataString() request.setOutput(result) # Process it self.runSession(request) # If its a 207 we want to parse the XML if request.getStatusCode() == statuscodes.MultiStatus: parser = PropFindParser() parser.parseData(result.getData()) # Look at each principal-match result and return first one that is appropriate for item in parser.getResults().itervalues(): for prop in props: if str(prop) in item.getNodeProperties(): href = item.getNodeProperties()[str(prop)].find( str(davxml.href)) if href is not None: results[prop] = URL(url=href.text, decode=True) # We'll take the first one, whatever that is break else: self.handleHTTPError(request) return None return results
def getSelfProperties(self, rurl, props): assert(isinstance(rurl, URL)) results = {} # Create WebDAV principal-match request = PrincipalMatch(self, rurl.relativeURL(), props) result = ResponseDataString() request.setOutput(result) # Process it self.runSession(request) # If its a 207 we want to parse the XML if request.getStatusCode() == statuscodes.MultiStatus: parser = PropFindParser() parser.parseData(result.getData()) # Look at each principal-match result and return first one that is appropriate for item in parser.getResults().itervalues(): for prop in props: if str(prop) in item.getNodeProperties(): href = item.getNodeProperties()[str(prop)].find(str(davxml.href)) if href is not None: results[prop] = URL(url=href.text, decode=True) # We'll take the first one, whatever that is break else: self.handleHTTPError(request) return None return results