13 this file is part of the project scolasync
15 Copyright (C) 2012 Georges Khaznadar <georgesk@ofset.org>
17 This program is free software: you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation, either version3 of the License, or
20 (at your option) any later version.
22 This program is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
27 You should have received a copy of the GNU General Public License
28 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 import xml.dom.minidom, copy
65 return "Cette fonction est abstraite, ne l'appelez pas ainsi."
73 return "Cette fonction est abstraite, ne l'appelez pas ainsi."
87 AbstractGestClasse.__init__(self,f)
91 file=open(f,
"r", encoding="iso-8859-1")
105 for el
in self.nullTexts.keys():
111 for e
in el.childNodes:
112 if e.nodeType==e.TEXT_NODE
and e.data.strip()==
"":
147 if el.nodeName.lower()==
"eleve" and el.getAttribute(
"ELEVE_ID")==self.
currentID:
148 self.currentResult.append(el)
157 if el.nodeName.lower()==
"structures_eleve":
158 structures=el.getElementsByTagName(
"STRUCTURE")
159 if len (structures) > 0:
160 if structures[0].getElementsByTagName(
"TYPE_STRUCTURE")[0].firstChild.data==
"D":
161 if structures[0].getElementsByTagName(
"CODE_STRUCTURE")[0].firstChild.data==self.
currentClassName:
162 idEleve=el.getAttribute(
"ELEVE_ID")
163 self.currentResult.append(idEleve)
171 if el.nodeName.lower()==
"structure":
172 if el.getElementsByTagName(
"TYPE_STRUCTURE")[0].firstChild.data==
"D":
173 self.classes.add(el.getElementsByTagName(
"CODE_STRUCTURE")[0].firstChild.data)
186 items.append(el.getElementsByTagName(f)[0].firstChild.data)
187 items.append(el.getAttribute(
"ELEVE_ID"))
188 return "_".join(items)
199 items.append(el.getElementsByTagName(f)[0].firstChild.data)
200 return " ".join(items)
212 for e
in el.childNodes:
216 return self.donnees.toprettyxml(indent=
" ",encoding=
"utf-8")
Une classe pour travailler avec des données Sconet.
def __init__(self, f)
le constructeur
def unique_name(self, el, fields=["NOM", PRENOM)
a unique name for an "eleve", based on a few fields and on the ID
def elevesDeClasse(self, className)
def eleveParID(self, el)
appends the "eleve" element to the list self.currentResult if self.currentID is matched ...
def unique_name(self, el)
def elementsWalk(self, el, proc)
implemente un parcour des éléments d'un arbre, pour y appliquer une procédure
def makeCompact(self)
removes useless thext nodes containing only spaces.
def showable_name(self, el, fields=["NOM", PRENOM)
def collectNullTexts(self, el)
def collectOneClass(self, el)
adds one class name to the set self.classes
def elevesDeClasse(self, cl)
def __init__(self, f)
Le constructeur.
def unIDEleveDeClasse(self, el)
appends the ID of an "eleve" to self.currentResult if he belongs to the class self.currentClassName
def showable_name(self, el)