1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 def EcritErreur(listeGena,ligne=None) :
28 from sys import dict_erreurs
30 for Mot in listeGena :
35 if maClef in dict_erreurs.keys() :
37 logging.warning("ligne %d : %s ",ligne,dict_erreurs[maClef])
39 logging.warning("%s",dict_erreurs[maClef])
42 for Mot in listeGena[:-1] :
45 maClef=maCle+"_"+"VALEUR"
46 if maClef in dict_erreurs.keys() :
48 logging.warning("ligne %d : %s ",ligne,dict_erreurs[maClef])
50 logging.warning("%s",dict_erreurs[maClef])
54 def GenereErreurPourCommande(jdc,listeCommande) :
55 commands= jdc.root.childNodes[:]
59 for Mot in listeCommande :
60 if c.name != Mot :continue
61 EcritErreur((Mot,),c.lineno)
63 def GenereErreurMotCleInFact(jdc,command,fact,mocle):
64 for c in jdc.root.childNodes:
65 if c.name != command:continue
66 for mc in c.childNodes:
67 if mc.name != fact:continue
70 for n in ll.childNodes:
74 EcritErreur((command,fact,mocle,),c.lineno)
76 def GenereErreurMCF(jdc,command,fact):
77 for c in jdc.root.childNodes:
78 if c.name != command:continue
79 for mc in c.childNodes:
83 EcritErreur((command,fact,),c.lineno)
85 def GenereErreurValeur(jdc,command,fact,list_valeur):
86 for c in jdc.root.childNodes:
87 if c.name != command:continue
88 for mc in c.childNodes:
89 if mc.name != fact:continue
91 for valeur in list_valeur:
92 trouve=texte.find(valeur)
94 logging.warning("%s doit etre supprimee ou modifiee dans %s : ligne %d",valeur,c.name,mc.lineno)
96 def GenereErreurValeurDsMCF(jdc,command,fact,mocle,list_valeur):
97 for c in jdc.root.childNodes:
98 if c.name != command:continue
99 for mc in c.childNodes:
100 if mc.name != fact:continue
103 for n in ll.childNodes:
104 if n.name != mocle:continue
106 for valeur in list_valeur:
107 trouve=texte.find(valeur)
109 logging.warning("%s doit etre supprimee ou modifiee dans %s : ligne %d",valeur,c.name,n.lineno)