예제 #1
0
파일: bind.py 프로젝트: gingerkaan/serveros
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)
예제 #2
0
        # 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)
예제 #3
0
            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)