def doBind(): import txweb2.dav.method from txweb2.dav.resource import DAVResource bindMethods(txweb2.dav.method, DAVResource) import twistedcaldav.method from twistedcaldav.resource import CalDAVResource bindMethods(twistedcaldav.method, CalDAVResource)
# If we're not backed by a directory, we have no children. # But check for existance first; we might be a collection resource # that the request wants created. self.fp.restat(False) if self.fp.exists() and not self.fp.isdir(): return (None, ()) # OK, we need to return a child corresponding to the first segment path = segments[0] if path == "": # Request is for a directory (collection) resource return (self, ()) return (self.createSimilarFile(self.fp.child(path).path), segments[1:]) def createSimilarFile(self, path): return self.__class__(path, defaultType=self.defaultType, indexNames=self.indexNames[:], principalCollections=self.principalCollections()) # # Attach method handlers to DAVFile # import txweb2.dav.method bindMethods(txweb2.dav.method, DAVFile)
raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Invalid URL path")) # If we're not backed by a directory, we have no children. # But check for existance first; we might be a collection resource # that the request wants created. self.fp.restat(False) if self.fp.exists() and not self.fp.isdir(): return (None, ()) # OK, we need to return a child corresponding to the first segment path = segments[0] if path == "": # Request is for a directory (collection) resource return (self, ()) return (self.createSimilarFile(self.fp.child(path).path), segments[1:]) def createSimilarFile(self, path): return self.__class__( path, defaultType=self.defaultType, indexNames=self.indexNames[:], principalCollections=self.principalCollections()) # # Attach method handlers to DAVFile # import txweb2.dav.method bindMethods(txweb2.dav.method, DAVFile)