def get_structures(self): """ Get structures info from structures xml """ self.log(logging.INFO, "Getting structures") self.get_parameters("BEE_STRUCTURES") # TODO: Check params consistency self.structures = {} self.grouplinks = {} for division in self.xml['BEE_STRUCTURES'].\ findall('./DONNEES/DIVISIONS/DIVISION'): grp = Group(gtype='div', gdomain='loc', gsource='imp') grp.code = division.get('CODE_STRUCTURE') grp.abbr = grp.code grp.title = grp.code grp.description = self._gtb(division, "LIBELLE_LONG", grp.code) self.grouplinks[grp.code] = [] for mef in division.findall('MEFS_APPARTENANCE/MEF_APPARTENANCE'): mef = self._gtb(mef, "CODE_MEF", "") self.grouplinks[grp.code].append(self.mefs[mef]) grp.school = self.school # SEE: school RNE/REF ? self.structures[grp.code] = grp self.log(logging.INFO, "Getting structures : DONE", commit=True) return self.structures
def get_matieres(self): """ Get matieres from nomenclatures xml """ self.log(logging.INFO, "Getting matieres") self.matieres = {} self.grouplinks = {} for mat in self.xml['BEE_NOMENCLATURES'].\ findall('./DONNEES/MATIERES/MATIERE'): matiere = Group(gtype='mat', gdomain='gen', gsource='imp') matiere.code = mat.get('CODE_MATIERE') matiere.abbr = self._gtb(mat, "CODE_GESTION", "") matiere.title = self._gtb(mat, "LIBELLE_COURT", "") matiere.description = self._gtb(mat, "LIBELLE_EDITION", matiere.title) mef = self._gtb(mat, "MEF_RATTACHEMENT", None) if mef is not None: self.grouplinks[matiere.code] = self.mefs[mef] self.matieres[matiere.code] = matiere self.log(logging.DEBUG, "Found matiere %s %s" % \ (matiere.code, matiere.title)) self.log(logging.INFO, "Getting matieres : DONE", commit=True) return self.matieres