def __init__(self): "Save and check a PROPFIND request, must call the instance to generate response" self.path = request.path_info # check if it exists... if not vfs.exists(self.path): raise exc.HTTPNotFound() check_if_forbidden(self.path) body = request.body if not body: raise exc.HTTPUnsupportedMediaType(explanation="PROPFIND request must provide an XML body.") self.xmlreq = ET.fromstring(body) # check if depth is correct... depth = request.headers.get("Depth", "infinity") if depth != "1" and depth != "0": raise exc.HTTPForbidden(explanation="PROPFIND only allows Depth of 0 or 1 (propfind-finite-depth).") else: self.depth = depth # if it's a file, depth must be 0 if vfs.isfile(self.path): self.depth = "0"
def serve_page(): path = request.path_info action = request.GET.get('action') if not vfs.exists(path): raise exc.HTTPNotFound() check_if_forbidden(path) # action is not defined? use defaults... if not action: if vfs.isdir(path): action = 'listdir' else: action = 'view' return CONFIG['filemanager_backend'].run_action(action)