Salome HOME
gitignore V1
[tools/eficas.git] / Validation / V_MCLIST.py
index 0dc3fcdb0498acba36eeecc8fd16a6c181bdcaf8..6bc3aae115e3781c1acb49fa1d66c8e417434959 100644 (file)
@@ -1,24 +1,22 @@
-#@ MODIF V_MCLIST Validation  DATE 14/09/2004   AUTEUR MCOURTOI M.COURTOIS 
 # -*- coding: iso-8859-1 -*-
-#            CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR   
-# (AT YOUR OPTION) ANY LATER VERSION.                                 
+# Copyright (C) 2007-2013   EDF R&D
 #
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT 
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF          
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU    
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.                            
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE   
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,       
-#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.      
-#                                                                       
-#                                                                       
-# ======================================================================
 
 
 """
    utilisée par héritage multiple pour composer les traitements.
 """
 # Modules Python
-import string
 import traceback
 
 # Modules EFICAS
 from Noyau import N_CR
 from Noyau.N_Exception import AsException
+from Noyau.strfunc import ufmt
 
 class MCList:
    """
@@ -46,18 +44,18 @@ class MCList:
       - txt_nat qui sert pour les comptes-rendus liés à cette classe
    """
 
-   CR=N_CR.CR
-   txt_nat="Mot cle Facteur Multiple :"
+   CR = N_CR.CR
+   txt_nat = u"Mot clé Facteur Multiple :"
 
    def isvalid(self,cr='non'):
-      """ 
+      """
          Methode pour verifier la validité du MCList. Cette méthode
          peut etre appelée selon plusieurs modes en fonction de la valeur
          de cr.
 
          Si cr vaut oui elle crée en plus un compte-rendu.
 
-         On n'utilise pas d'attribut pour stocker l'état et on ne remonte pas 
+         On n'utilise pas d'attribut pour stocker l'état et on ne remonte pas
          le changement d'état au parent (pourquoi ??)
          MCLIST est une liste de MCFACT. Les MCFACT ont le meme parent
          que le MCLIST qui les contient. Il n'est donc pas necessaire de
@@ -72,42 +70,45 @@ class MCList:
       if definition.min is not None and len(self.data) < definition.min :
          valid=0
          if cr == 'oui' :
-            self.cr.fatal("Nombre de mots cles facteurs insuffisant minimum : %s" % definition.min)
+            self.cr.fatal(_(u"Nombre de mots clés facteurs insuffisant minimum : %s"),
+                definition.min)
 
       if definition.max is not None and len(self.data) > definition.max :
          valid=0
          if cr == 'oui' :
-            self.cr.fatal("Nombre de mots cles facteurs trop grand maximum : %s" % definition.max)
+            self.cr.fatal(_(u"Nombre de mots clés facteurs trop grand maximum : %s"),
+                definition.max)
       num = 0
       for i in self.data:
         num = num+1
         if not i.isvalid():
           valid = 0
           if cr=='oui' and len(self) > 1:
-            self.cr.fatal(string.join(["L'occurrence n",`num`," du mot-clé facteur :",self.nom," n'est pas valide"]))
+            self.cr.fatal(_(u"L'occurrence numéro %d du mot-clé facteur : %s n'est pas valide"),
+                num, self.nom)
       return valid
 
    def report(self):
-      """ 
-          Génère le rapport de validation de self 
+      """
+          Génère le rapport de validation de self
       """
       if len(self) > 1:
          # Mot cle facteur multiple
-         self.cr=self.CR( debut = "Mot-clé facteur multiple : "+self.nom,
-                  fin = "Fin Mot-clé facteur multiple : "+self.nom)
+         self.cr=self.CR( debut = u"Mot-clé facteur multiple : "+self.nom,
+                  fin = u"Fin Mot-clé facteur multiple : "+self.nom)
          for i in self.data:
            self.cr.add(i.report())
       elif len(self) == 1:
          # Mot cle facteur non multiple
          self.cr=self.data[0].report()
       else:
-         self.cr=self.CR( debut = "Mot-cle facteur : "+self.nom,
-                  fin = "Fin Mot-cle facteur : "+self.nom)
+         self.cr=self.CR( debut = u"Mot-clé facteur : "+self.nom,
+                  fin = u"Fin Mot-clé facteur : "+self.nom)
 
       try :
         self.isvalid(cr='oui')
       except AsException,e:
         if CONTEXT.debug : traceback.print_exc()
-        self.cr.fatal(string.join(["Mot-clé facteur multiple : ",self.nom,str(e)]))
+        self.cr.fatal(_(u"Mot-clé facteur multiple : %s, %s"), self.nom, e)
       return self.cr