예제 #1
0
 def end_attribute(self, obj: T):
     """Assign the schema's default form for attributes if the given
     attribute form is None."""
     if isinstance(
             obj,
             xsd.Attribute) and obj.form is None and self.attribute_form:
         obj.form = FormType(self.attribute_form)
예제 #2
0
    def end_complex_type(self, obj: T):
        """Prepend an attribute group reference when default attributes
        apply."""
        if not isinstance(obj, xsd.ComplexType):
            return

        if obj.default_attributes_apply and self.default_attributes:
            attribute_group = xsd.AttributeGroup(ref=self.default_attributes)
            obj.attribute_groups.insert(0, attribute_group)

        if not obj.open_content:
            obj.open_content = self.default_open_content
예제 #3
0
 def end_restriction(self, obj: T):
     """Set the open content if any to the given restriction."""
     if isinstance(obj, xsd.Restriction) and not obj.open_content:
         obj.open_content = self.default_open_content
예제 #4
0
 def end_extension(self, obj: T):
     """Set the open content if any to the given extension."""
     if isinstance(obj, xsd.Extension) and not obj.open_content:
         obj.open_content = self.default_open_content
예제 #5
0
 def end_element(self, obj: T):
     """Assign the schema's default form for elements if the given element
     form is None."""
     if isinstance(obj,
                   xsd.Element) and obj.form is None and self.element_form:
         obj.form = FormType(self.element_form)
예제 #6
0
 def end_definitions(self, obj: T):
     """Normalize various properties for the schema and it's children."""
     if isinstance(obj, wsdl.Definitions) and self.location:
         obj.location = self.location
         for imp in obj.imports:
             imp.location = self.resolve_path(imp.location)