From 4d0f301ce379f264fdbafaa416193acb860eba9f Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Wed, 23 Sep 2020 11:19:55 +0200 Subject: [PATCH] partage avec eric --- Efi2Xsd/MCAccasXML.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Efi2Xsd/MCAccasXML.py b/Efi2Xsd/MCAccasXML.py index 22ea189e..d9dd432b 100755 --- a/Efi2Xsd/MCAccasXML.py +++ b/Efi2Xsd/MCAccasXML.py @@ -128,7 +128,11 @@ class X_MCSIMP(X_OBJECT): print ('self.maClasseModeleMetierFactory', self.maClasseModeleMetierFactory) else : self.needFactory=False else : + print ('_____________________uuuuuuuuuuuuuuuuuuuu') + print (self.cata.DicoNomTypeDifferentNomElt) + print ('_____________________uuuuuuuuuuuuuuuuuuuu') self.monNomClasseModeleMetier='T_'+self.nom + if self.monNomClasseModeleMetier=='T_termeLE' : monNomClasseModeleMetier= 'T_termeLE_1' if self.nom in list(self.cata.DicoNomTypeDifferentNomElt.keys()) : self.monNomClasseModeleMetier=self.cata.DicoNomTypeDifferentNomElt[self.nom][self.nomComplet()] self.maClasseModeleMetier=getattr(self.cata.modeleMetier,self.monNomClasseModeleMetier) @@ -139,7 +143,12 @@ class X_MCSIMP(X_OBJECT): else : self.needFactory=False if self.valeur != None : - if self.needFactory : self.objPyxb=self.maClasseModeleMetierFactory(self.valeur) + if self.needFactory : + if self.definition.max > 1 : + print (self.monNomClasseModeleMetier) + exit() + self.objPyxb=self.maClasseModeleMetier(self.valeur) + else : self.objPyxb=self.maClasseModeleMetierFactory(self.valeur) else : self.objPyxb=self.maClasseModeleMetier(self.valeur) else : if self.needFactory : self.objPyxb=None @@ -242,11 +251,12 @@ class X_MCCOMPO(X_OBJECT) : max=obj[0].definition.max else : max = 1 if max == 1 : - print ('kkkkkkkkkkkkkkkkkkkkk',obj, type(obj)) - if not(issubclass(type(obj), pyxb.binding.basis.enumeration_mixin) ): - newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:id(o.value), self.objPyxb.orderedContent())).index(id(obj))] ) - else : - newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:type(o.value), self.objPyxb.orderedContent())).index(type(obj))] ) + #if not(issubclass(type(obj), pyxb.binding.basis.enumeration_mixin) ): + # newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:id(o.value), self.objPyxb.orderedContent())).index(id(obj))] ) + #else : + # newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:type(o.value), self.objPyxb.orderedContent())).index(type(obj))] ) + # PN 22 sept 2020 . pourquoi pas toujours l id. le tyoe ne convient pas en cas d union d enum + newOrderedContent.append(self.objPyxb.orderedContent()[list(map(lambda o:id(o.value), self.objPyxb.orderedContent())).index(id(obj))] ) else : # element Pural for c in self.objPyxb.orderedContent() : if isinstance(c._Content__value,list) and isinstance(c._Content__value[0], type(obj[0].objPyxb)): newOrderedContent.append(c) -- 2.39.2