Ejemplo n.º 1
0
    def init_from_path(self, path):

        # Read repositories from xml description file
        repoDescriptionPath = os.path.join(path, "repository.xml")
        if os.path.isfile(repoDescriptionPath):
            f = open(repoDescriptionPath, 'r')
            dom = parse(f)
            self.parse_description(dom)
        else:
            self.set_id(os.path.basename(path))
            self.set_name(os.path.basename(path))

        groupPathList = os.listdir(self.get_local_path())

        for groupPath in groupPathList:
            path = os.path.join(self.get_local_path(), groupPath)
            if os.path.isdir(path):
                group = ExerciseRepositoryGroup()
                group.init_from_path(path)
                group.set_system(self.system)
                self.add_group(group)
Ejemplo n.º 2
0
    def init_from_path(self, path):

        # Read repositories from xml description file
        repoDescriptionPath = os.path.join(path, "repository.xml")
        if os.path.isfile(repoDescriptionPath):
            f = open(repoDescriptionPath, 'r')
            dom = parse(f)
            self.parse_description(dom)
        else:
            self.set_id(os.path.basename(path))
            self.set_name(os.path.basename(path))

        groupPathList = os.listdir(self.get_local_path())

        for groupPath in groupPathList:
            path = os.path.join(self.get_local_path(), groupPath)
            if os.path.isdir(path):
                group = ExerciseRepositoryGroup()
                group.init_from_path(path)
                group.set_system(self.system)
                self.add_group(group)