Commits

jortel  committed 215acfe

Fix building xsd types using the builder with mixed content (string w/ attributes).

  • Participants
  • Parent commits ae82297

Comments (0)

Files changed (3)

File suds/builder.py

         else:
             type = name
         cls = type.name
-        if len(type):
+        if type.mixed():
+            data = Factory.property(cls)
+        else:
             data = Factory.object(cls)
-        else:
-            data = Factory.property(cls)
         resolved = type.resolve()
         md = data.__metadata__
         md.sxtype = resolved
             value = []
         else:
             if len(resolved) > 0:
-                value = Factory.object(resolved.name)
-                md = value.__metadata__
-                md.sxtype = resolved
-                md.ordering = self.ordering(resolved)
+                if resolved.mixed():
+                    value = Factory.property(resolved.name)
+                    md = value.__metadata__
+                    md.sxtype = resolved
+                else:
+                    value = Factory.object(resolved.name)
+                    md = value.__metadata__
+                    md.sxtype = resolved
+                    md.ordering = self.ordering(resolved)
         setattr(data, type.name, value)
         if value is not None:
             data = value

File suds/xsd/sxbase.py

         @rtype: boolean
         """
         return False
+    
+    def mixed(self):
+        """
+        Get whether this I{mixed} content.
+        """
+        return False
         
     def find(self, qref, classes=()):
         """

File suds/xsd/sxbasic.py

             if c.extension():
                 return True
         return False
+    
+    def mixed(self):
+        for c in self.rawchildren:
+            if isinstance(c, SimpleContent) and c.mixed():
+                return True
+        return False
 
 
 class Group(SchemaObject):
             if isinstance(child, Enumeration):
                 return True
         return False
+    
+    def mixed(self):
+        return len(self)
 
     def description(self):
         return ('name',)
             if c.restriction():
                 return True
         return False
+    
+    def mixed(self):
+        return len(self)
 
 
 class Enumeration(Content):
 
     def description(self):
         return ('ref',)
-
+    
 
 class Import(SchemaObject):
     """