Anonymous avatar Anonymous committed fd9bb78

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

Comments (0)

Files changed (3)

         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

suds/xsd/sxbase.py

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

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):
     """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.