コード例 #1
0
ファイル: XMLEleves.py プロジェクト: jmbarbier/djeskoolz
    def save_mefs(self):
        """
        Save mefs to db

        """
        self.log(logging.INFO, "Saving mefs")
        for mefid in self.mefs:
            mef = self.mefs[mefid]
            try:
                self.mefs[mefid] = \
                    Group.objects.get(gtype="mef", gdomain='gen',
                                      gsource='imp', code=mef.code)
                self.log(logging.DEBUG, "Found saved mef : %s" % mef.code)
            except ObjectDoesNotExist:
                self.log(logging.INFO, "Stored new MEF : %s" % (mef.code,))
                self.mefs[mefid].save()
        # Resolve links
        self.log(logging.DEBUG, "Resolving links")
        for mefid in self.grouplinks:
            mef = self.mefs[mefid]
            self.log(logging.DEBUG, "Found link")
            tolink = GroupLink(ltype='mef',
                               lsrc=mef,
                               ldest=self.mefs[self.grouplinks[mefid]])
            tolink.save()
            self.log(logging.DEBUG, "Added link")
        self.log(logging.INFO, "Saving mefs : DONE", commit=True)
コード例 #2
0
ファイル: XMLEleves.py プロジェクト: jmbarbier/djeskoolz
    def save_matieres(self):
        """
        Save matieres to db

        """
        self.log(logging.INFO, "Saving matieres",)
        for matid in self.matieres:
            mat = self.matieres[matid]
            try:
                self.matieres[matid] = \
                    Group.objects.get(gtype='mat', gdomain='gen',
                                      gsource='imp', code=mat.code)
                self.log(logging.DEBUG,
                         "Found stored matiere : %s" % (mat.title,))
            except ObjectDoesNotExist:
                self.log(logging.INFO, "Stored new matiere : %s" % (mat.title))
                self.matieres[matid].save()
        for matid in self.grouplinks:
            link = GroupLink(ltype='mef',
                             ldest=self.grouplinks[matid],
                             lsrc=self.matieres[matid])
            link.save()
        self.log(logging.INFO, "Saving matieres : DONE", commit=True)
コード例 #3
0
ファイル: XMLEleves.py プロジェクト: jmbarbier/djeskoolz
    def save_structures(self):
        """
        Save structure data to db

        """
        self.log(logging.INFO, "Saving structures")
        for sid in self.structures:
            struct = self.structures[sid]
            try:
                self.structures[sid] = \
                    Group.objects.get(gtype="div", gdomain='loc',
                                      gsource='imp', school=struct.school,
                                      code=struct.code)
                self.log(logging.DEBUG, "Found stored div : %s" % struct.code)
            except ObjectDoesNotExist:
                self.log(logging.INFO, "Stored new DIV : %s" % struct.code)
                self.structures[sid].save()
                for meflink in self.grouplinks[sid]:
                    link = GroupLink(ltype='mef', lsrc=self.structures[sid],
                                 ldest=meflink)
                    link.save()
                self.structures[sid] = Group.objects.get(
                    pk=self.structures[sid].pk)
        self.log(logging.INFO, "Saving structures : DONE")