コード例 #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
ファイル: webdav.py プロジェクト: wicket1001/INGInious
    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
ファイル: webdav.py プロジェクト: zootos/INGInious
    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)