Salome HOME
travail sur monPlusieurs
[tools/eficas.git] / Noyau / N_OPER.py
index c5afbd80662670c039cf2ef8b12d6cb8d6d5dadb..e5e8a0372d1744352fbf074f682e8ded543cd5f7 100644 (file)
@@ -1,25 +1,24 @@
-# -*- coding: utf-8 -*-
-#@ MODIF N_OPER Noyau  DATE 09/10/2002   AUTEUR DURAND C.DURAND 
-#            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.                                 
+# -*- coding: iso-8859-1 -*-
+# 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.
 #
-# 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.      
-#                                                                       
-#                                                                       
-# ======================================================================
-""" 
+# 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
+#
+
+"""
     Ce module contient la classe de definition OPER
     qui permet de spécifier les caractéristiques d'un opérateur
 """
@@ -29,15 +28,16 @@ import types,string,traceback
 import N_ENTITE
 import N_ETAPE
 import nommage
+from strfunc import ufmt
 
 class OPER(N_ENTITE.ENTITE):
    """
     Classe pour definir un opérateur
 
-    Cette classe a trois attributs de classe 
+    Cette classe a trois attributs de classe
 
-    - class_instance qui indique la classe qui devra etre utilisée 
-            pour créer l'objet qui servira à controler la conformité d'un 
+    - class_instance qui indique la classe qui devra etre utilisée
+            pour créer l'objet qui servira à controler la conformité d'un
             opérateur avec sa définition
 
     - label qui indique la nature de l'objet de définition (ici, OPER)
@@ -115,6 +115,7 @@ class OPER(N_ENTITE.ENTITE):
          self.niveau.enregistre(self)
       self.UIinfo=UIinfo
       self.affecter_parente()
+      self.check_definition(self.nom)
 
    def __call__(self,reuse=None,**args):
       """
@@ -127,10 +128,10 @@ class OPER(N_ENTITE.ENTITE):
       return etape.Build_sd(nomsd)
 
    def make_objet(self,mc_list='oui'):
-      """ 
+      """
            Cette méthode crée l'objet ETAPE dont la définition est self sans
             l'enregistrer ni créer sa sdprod.
-           Si l'argument mc_list vaut 'oui', elle déclenche en plus la construction 
+           Si l'argument mc_list vaut 'oui', elle déclenche en plus la construction
            des objets MCxxx.
       """
       etape= self.class_instance(oper=self,reuse=None,args={})
@@ -141,18 +142,12 @@ class OPER(N_ENTITE.ENTITE):
       """
           Méthode de vérification des attributs de définition
       """
-      if type(self.regles) != types.TupleType :
-        self.cr.fatal("L'attribut 'regles' doit etre un tuple : %s" %`self.regles`)
-      if type(self.fr) != types.StringType :
-        self.cr.fatal("L'attribut 'fr' doit etre une chaine de caractères : %s" %`self.fr`)
-      if self.reentrant not in ('o','n','f'):
-        self.cr.fatal("L'attribut 'reentrant' doit valoir 'o','n' ou 'f' : %s" %`self.reentrant`)
-      if type(self.docu) != types.StringType :
-        self.cr.fatal("L'attribut 'docu' doit etre une chaine de caractères : %s" %`self.docu` )
-      if type(self.nom) != types.StringType :
-        self.cr.fatal("L'attribut 'nom' doit etre une chaine de caractères : %s" %`self.nom`)
-      if type(self.op) != types.IntType :
-        self.cr.fatal("L'attribut 'op' doit etre un entier signé : %s" %`self.op`)
+      self.check_regles()
+      self.check_fr()
+      self.check_reentrant()
+      self.check_docu()
+      self.check_nom()
+      self.check_op(valmin=0)
       self.verif_cata_regles()
 
    def supprime(self):