Пример #1
0
    def get_resource_inst(self, path, environ):
        fp = self._loc_to_file_path(path, environ)
        if not os.path.exists(fp):
            if environ['REQUEST_METHOD'] == 'PUT':
                head, _ = os.path.split(fp)
                os.makedirs(head, exist_ok=True)
            return None

        if os.path.isdir(fp):
            return FolderResource(path, environ, fp)
        return FileResource(path, environ, fp)
Пример #2
0
    def getResourceInst(self, path, environ):
        """Return info dictionary for path.

        See DAVProvider.getResourceInst()
        """
        self._count_getResourceInst += 1
        fp = self._locToFilePath(path)
        if not os.path.exists(fp):
            return None

        if os.path.isdir(fp):
            return FolderResource(path, environ, fp)
        return FileResource(path, environ, fp)
Пример #3
0
    def getResourceInst(self, path, environ):
        """Return info dictionary for path.

        See DAVProvider.getResourceInst()
        """
        self._count_getResourceInst += 1
        fp = self._locToFilePath(path)
        if not os.path.exists(fp):
            return None

        if os.path.isdir(fp):
            return FolderResource(path, environ, fp)

        # course.yaml needs a special protection
        inner_path = self._get_inner_path(path)
        if len(inner_path) == 1 and inner_path[0] in ["course.yaml", "course.json"]:
            return INGIniousDAVCourseFile(path, environ, fp, self.course_factory, self._get_course_id(path))

        return FileResource(path, environ, fp)
Пример #4
0
 def createEmptyResource(self, name):
     logger.debug('%s -> createEmptyResource(%s)' % (self.getRefUrl(), name))
     return FolderResource.createEmptyResource(self, name)
Пример #5
0
 def createCollection(self, name):
     logger.debug('%s -> createCollection(%s)' % (self.getRefUrl(), name))
     FolderResource.createCollection(self, name)
Пример #6
0
 def __init__(self, path, environ, fp, pathMapper):
     FolderResource.__init__(self, path, environ, fp)
     _WTDAVResource.__init__(self, pathMapper)