def do_DELETE(self): """ delete an resource """ dc=self.IFACE_CLASS uri=urlparse.urljoin(dc.BASEURI,self.path) uri=urllib.unquote(uri) dl=DELETE(uri,dc) if dc.is_collection(uri): res=dl.delcol() else: res=dl.delone() if res: self.send_status(207,body=res) else: self.send_status(204)
def do_DELETE(self): """ delete an resource """ dc = self.IFACE_CLASS uri = urlparse.urljoin(dc.BASEURI, self.path) uri = urllib.unquote(uri) dl = DELETE(uri, dc) if dc.is_collection(uri): res = dl.delcol() else: res = dl.delone() if res: self.send_status(207, body=res) else: self.send_status(204)
def do_DELETE(self): """ delete an resource """ dc = self.IFACE_CLASS uri = urlparse.urljoin(self.get_baseuri(dc), self.path) uri = urllib.unquote(uri) # hastags not allowed if uri.find('#') >= 0: return self.send_status(404) # locked resources are not allowed to delete if self._l_isLocked(uri): return self.send_body(None, 423, 'Locked', 'Locked') # Handle If-Match if 'If-Match' in self.headers: test = False etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers['If-Match'].split(','): if match == '*': if dc.exists(uri): test = True break else: if match == etag: test = True break if not test: self.send_status(412) self.log_request(412) return # Handle If-None-Match if 'If-None-Match' in self.headers: test = True etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers['If-None-Match'].split(','): if match == '*': if dc.exists(uri): test = False break else: if match == etag: test = False break if not test: self.send_status(412) self.log_request(412) return try: dl = DELETE(uri, dc) if dc.is_collection(uri): res = dl.delcol() if res: self.send_status(207, body=res) else: self.send_status(204) else: res = dl.delone() or 204 self.send_status(res) except DAV_NotFound: self.send_body(None, 404, 'Not Found', 'Not Found')
def do_DELETE(self): """ delete an resource """ dc = self.IFACE_CLASS uri = urlparse.urljoin(self.get_baseuri(dc), self.path) uri = urllib.unquote(uri) # Handle If-Match if self.headers.has_key('If-Match'): test = False etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers['If-Match'].split(','): if match == '*': if dc.exists(uri): test = True break else: if match == etag: test = True break if not test: self.send_status(412) self.log_request(412) return # Handle If-None-Match if self.headers.has_key('If-None-Match'): test = True etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers['If-None-Match'].split(','): if match == '*': if dc.exists(uri): test = False break else: if match == etag: test = False break if not test: self.send_status(412) self.log_request(412) return # locked resources are not allowed to delete if self._l_isLocked(uri): return self.send_body(None, '423', 'Locked', 'Locked') dl = DELETE(uri, dc) if dc.is_collection(uri): res = dl.delcol() if res: self.send_status(207, body=res) else: self.send_status(204) else: res = dl.delone() or 204 self.send_status(res)
def do_DELETE(self): """ delete an resource """ dc = self.IFACE_CLASS uri = urlparse.urljoin(self.get_baseuri(dc), self.path) uri = urllib.unquote(uri) # hastags not allowed if uri.find("#") >= 0: return self.send_status(404) # locked resources are not allowed to delete if self._l_isLocked(uri): return self.send_body(None, 423, "Locked", "Locked") # Handle If-Match if "If-Match" in self.headers: test = False etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers["If-Match"].split(","): if match == "*": if dc.exists(uri): test = True break else: if match == etag: test = True break if not test: self.send_status(412) self.log_request(412) return # Handle If-None-Match if "If-None-Match" in self.headers: test = True etag = None try: etag = dc.get_prop(uri, "DAV:", "getetag") except: pass for match in self.headers["If-None-Match"].split(","): if match == "*": if dc.exists(uri): test = False break else: if match == etag: test = False break if not test: self.send_status(412) self.log_request(412) return try: dl = DELETE(uri, dc) if dc.is_collection(uri): res = dl.delcol() if res: self.send_status(207, body=res) else: self.send_status(204) else: res = dl.delone() or 204 self.send_status(res) except DAV_NotFound: self.send_body(None, 404, "Not Found", "Not Found")