Ejemplo n.º 1
0
 def createCollection(self, name):
     """Create a new collection as member of self.
     
     See DAVResource.createCollection()
     """
     assert not "/" in name
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     path = util.joinUri(self.path, name)
     fp = self.provider._locToFilePath(path)
     os.mkdir(fp)
Ejemplo n.º 2
0
 def createCollection(self, name):
     """Create a new collection as member of self.
     
     See DAVResource.createCollection()
     """
     assert not "/" in name
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)               
     path = util.joinUri(self.path, name) 
     fp = self.provider._locToFilePath(path)
     os.mkdir(fp)
Ejemplo n.º 3
0
 def createEmptyResource(self, name):
     """Create an empty (length-0) resource.
     
     See DAVResource.createEmptyResource()
     """
     assert not "/" in name
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)               
     path = util.joinUri(self.path, name) 
     fp = self.provider._locToFilePath(path)
     f = open(fp, "w")
     f.close()
     return self.provider.getResourceInst(path, self.environ)
Ejemplo n.º 4
0
 def createEmptyResource(self, name):
     """Create an empty (length-0) resource.
     
     See DAVResource.createEmptyResource()
     """
     assert not "/" in name
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     path = util.joinUri(self.path, name)
     fp = self.provider._locToFilePath(path)
     f = open(fp, "w")
     f.close()
     return self.provider.getResourceInst(path, self.environ)
Ejemplo n.º 5
0
    def getMember(self, name):
        """Return direct collection member (DAVResource or derived).
        
        See DAVCollection.getMember()
        """
        fp = os.path.join(self._filePath, name.decode("utf8"))
#        name = name.encode("utf8")
        path = util.joinUri(self.path, name)
        if os.path.isdir(fp):
            res = FolderResource(path, self.environ, fp)
        elif os.path.isfile(fp):
            res = FileResource(path, self.environ, fp)
        else:
            _logger.debug("Skipping non-file %s" % fp)
            res = None
        return res
Ejemplo n.º 6
0
 def getMember(self, name):
     """Return direct collection member (DAVResource or derived).
     
     See DAVCollection.getMember()
     """
     fp = os.path.join(self._filePath, name.decode("utf8"))
     #        name = name.encode("utf8")
     path = util.joinUri(self.path, name)
     if os.path.isdir(fp):
         res = FolderResource(path, self.environ, fp)
     elif os.path.isfile(fp):
         res = FileResource(path, self.environ, fp)
     else:
         _logger.debug("Skipping non-file %s" % fp)
         res = None
     return res
Ejemplo n.º 7
0
    def getMember(self, name):
        """Return direct collection member (DAVResource or derived).
        
        See DAVCollection.getMember()
        """

        pathComponents = self.path.strip("/").split("/")
        if len(pathComponents)<=1:
            fp = os.path.join(self._filePath, name.split(" - ")[0].decode("utf8"))
        else:
            fp = os.path.join(self._filePath, name.decode("utf8"))
        name = name.encode("utf8")
        path = util.joinUri(self.path, name)
        if os.path.isdir(fp):
            res = FolderResource(path, self.environ, fp)
        elif os.path.isfile(fp):
            res = FileResource(path, self.environ, fp)
        else:
            _logger.debug("Skipping non-file %s" % fp)
            res = None
        return res