1 # -*- coding: iso-8859-1 -*-
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
22 Ce module contient la classe mixin PROC_ETAPE qui porte les méthodes
23 nécessaires pour réaliser la validation d'un objet de type PROC_ETAPE
26 Une classe mixin porte principalement des traitements et est
27 utilisée par héritage multiple pour composer les traitements.
31 from Noyau.N_Exception import AsException
32 from Noyau.N_utils import AsType
33 from Noyau.strfunc import ufmt
36 class PROC_ETAPE(V_ETAPE.ETAPE):
38 On réutilise les méthodes report,verif_regles
39 de ETAPE par héritage.
42 def isvalid(self,sd='oui',cr='non'):
44 Methode pour verifier la validité de l'objet PROC_ETAPE. Cette méthode
45 peut etre appelée selon plusieurs modes en fonction de la valeur
46 de sd et de cr (sd n'est pas utilisé).
48 Si cr vaut oui elle crée en plus un compte-rendu.
50 Cette méthode a plusieurs fonctions :
52 - retourner un indicateur de validité 0=non, 1=oui
54 - produire un compte-rendu : self.cr
56 - propager l'éventuel changement d'état au parent
58 if CONTEXT.debug : print "ETAPE.isvalid ",self.nom
59 if self.state == 'unchanged' :
62 valid=self.valid_child()
63 valid=valid * self.valid_regles(cr)
64 if self.reste_val != {}:
66 self.cr.fatal(_(u"Mots clés inconnus : %s"), ','.join(self.reste_val.keys()))