0

I trying to use spyne to generate a SOAP server, but have an error. Spyne: ValueError: classes <class CHILD'> and <class 'CHILD'> have conflicting name;

the types.py file is:

class PARENT(ComplexModel):   
    class Section1(ComplexModel):
      NAME = String
      class CHILD(ComplexModel):
         NAME = String   
    class Section2(ComplexModel):
      NAME = String
      class CHILD(ComplexModel):
         NAME = String
         type = String

Have not way to use same class name? spyne need to decalre on views as json and also declare a complexmodel as python classes, but cant use same name of class, but the application need to be return an xml that have this structure, thanks a lot.

Softsofter
  • 345
  • 1
  • 3
  • 13

1 Answers1

0

I has found solution. Using Array.

from spyne.model.complex import ComplexModel, Array

class CHILD(ComplexModel):
    NAME = String
    type = String
class PARENT(ComplexModel):   
    class Section1(ComplexModel):
      NAME = String
      class CHILD(ComplexModel):
         NAME = String   
    class Section2(ComplexModel):
      NAME = String
      CHILD = Array(CHILD)
Softsofter
  • 345
  • 1
  • 3
  • 13