Exemplo n.º 1
0
    def __init__(self, app=None, validator=None, xml_declaration=True,
                                                    cleanup_namespaces=False):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration
        self.cleanup_namespaces = cleanup_namespaces

        self.serialization_handlers = cdict({
            AnyXml: xml_to_parent_element,
            Alias: alias_to_parent_element,
            Fault: fault_to_parent_element,
            AnyDict: dict_to_parent_element,
            EnumBase: enum_to_parent_element,
            ModelBase: base_to_parent_element,
            ByteArray: binary_to_parent_element,
            Attachment: binary_to_parent_element,
            ComplexModelBase: complex_to_parent_element,
        })

        self.deserialization_handlers = cdict({
            AnyXml: xml_from_element,
            Fault: fault_from_element,
            AnyDict: dict_from_element,
            EnumBase: enum_from_element,
            ModelBase: base_from_element,
            Unicode: unicode_from_element,
            ByteArray: binary_from_element,
            Attachment: binary_from_element,
            ComplexModelBase: complex_from_element,

            Iterable: iterable_from_element,
            Array: array_from_element,
        })

        self.log_messages = (logger.level == logging.DEBUG)
Exemplo n.º 2
0
    def __init__(self,
                 app=None,
                 validator=None,
                 xml_declaration=True,
                 cleanup_namespaces=True,
                 encoding='UTF-8',
                 pretty_print=False):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration
        self.cleanup_namespaces = cleanup_namespaces
        self.encoding = encoding
        self.pretty_print = pretty_print

        self.serialization_handlers = cdict({
            AnyXml:
            xml_to_parent_element,
            Alias:
            alias_to_parent_element,
            Fault:
            fault_to_parent_element,
            AnyDict:
            dict_to_parent_element,
            AnyHtml:
            html_to_parent_element,
            EnumBase:
            enum_to_parent_element,
            ModelBase:
            base_to_parent_element,
            ByteArray:
            byte_array_to_parent_element,
            Attachment:
            attachment_to_parent_element,
            XmlAttribute:
            xmlattribute_to_parent_element,
            ComplexModelBase:
            complex_to_parent_element,
        })

        self.deserialization_handlers = cdict({
            AnyXml: xml_from_element,
            Fault: fault_from_element,
            AnyDict: dict_from_element,
            EnumBase: enum_from_element,
            ModelBase: base_from_element,
            Unicode: unicode_from_element,
            ByteArray: byte_array_from_element,
            Attachment: attachment_from_element,
            ComplexModelBase: complex_from_element,
            Alias: alias_from_element,
            Iterable: iterable_from_element,
            Array: array_from_element,
        })

        self.log_messages = (logger.level == logging.DEBUG)
        self.parser = etree.XMLParser(remove_comments=True)
Exemplo n.º 3
0
    def __init__(self, app=None, validator=None, mime_type=None,
            ignore_uncap=False, ignore_wrappers=True, complex_as=dict,
                                                                ordered=False):
        ProtocolBase.__init__(self, app, validator, mime_type, ignore_uncap)

        self.ignore_wrappers = ignore_wrappers
        self.complex_as = complex_as
        self.ordered = ordered
        if ordered:
            raise NotImplementedError('ordered == False')

        self.stringified_types = (DateTime, Date, Time, Uuid, Duration,
                                                                AnyXml, AnyHtml)
Exemplo n.º 4
0
    def __init__(
        self,
        app=None,
        validator=None,
        xml_declaration=True,
        cleanup_namespaces=True,
        encoding="UTF-8",
        pretty_print=False,
    ):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration
        self.cleanup_namespaces = cleanup_namespaces
        self.encoding = encoding
        self.pretty_print = pretty_print

        self.serialization_handlers = cdict(
            {
                AnyXml: xml_to_parent_element,
                Alias: alias_to_parent_element,
                Fault: fault_to_parent_element,
                AnyDict: dict_to_parent_element,
                AnyHtml: html_to_parent_element,
                EnumBase: enum_to_parent_element,
                ModelBase: base_to_parent_element,
                ByteArray: byte_array_to_parent_element,
                Attachment: attachment_to_parent_element,
                ComplexModelBase: complex_to_parent_element,
            }
        )

        self.deserialization_handlers = cdict(
            {
                AnyXml: xml_from_element,
                Fault: fault_from_element,
                AnyDict: dict_from_element,
                EnumBase: enum_from_element,
                ModelBase: base_from_element,
                Unicode: unicode_from_element,
                ByteArray: byte_array_from_element,
                Attachment: attachment_from_element,
                ComplexModelBase: complex_from_element,
                Alias: alias_from_element,
                Iterable: iterable_from_element,
                Array: array_from_element,
            }
        )

        self.log_messages = logger.level == logging.DEBUG
        self.parser = etree.XMLParser(remove_comments=True)
Exemplo n.º 5
0
    def __init__(self, app=None, validator=None, mime_type=None,
                                        ignore_uncap=False,
                                        ignore_wrappers=True,
                                        complex_as=dict,
                                        ordered=False):
        ProtocolBase.__init__(self, app, validator, mime_type, ignore_uncap)

        self.ignore_wrappers = ignore_wrappers
        self.complex_as = complex_as
        self.ordered = ordered
        if ordered:
            raise NotImplementedError('ordered == False')

        self.stringified_types = (DateTime, Date, Time, Uuid, Duration,
                                                                AnyXml, AnyHtml)
Exemplo n.º 6
0
    def __init__(self, app=None, validator=None):
        """Protocol that returns the response object as a html microformat. See
        https://en.wikipedia.org/wiki/Microformats for more info.

        The simple flavour is like the XmlDocument protocol, but returns data in
        <div> or <span> tags.

        :param app: A spyne.application.Application instance.
        :param validator: The validator to use. Ignored.
        :param root_tag: The type of the root tag that encapsulates the return
            data.
        :param child_tag: The type of the tag that encapsulates the fields of
            the returned object.
        :param field_name_attr: The name of the attribute that will contain the
            field names of the complex object children.
        :param field_type_attr: The name of the attribute that will contain the
            type names of the complex object children.
        """

        ProtocolBase.__init__(self, app, validator)
Exemplo n.º 7
0
    def __init__(self, app=None, validator=None):
        """Protocol that returns the response object as a html microformat. See
        https://en.wikipedia.org/wiki/Microformats for more info.

        The simple flavour is like the XmlDocument protocol, but returns data in
        <div> or <span> tags.

        :param app: A spyne.application.Application instance.
        :param validator: The validator to use. Ignored.
        :param root_tag: The type of the root tag that encapsulates the return
            data.
        :param child_tag: The type of the tag that encapsulates the fields of
            the returned object.
        :param field_name_attr: The name of the attribute that will contain the
            field names of the complex object children.
        :param field_type_attr: The name of the attribute that will contain the
            type names of the complex object children.
        """

        ProtocolBase.__init__(self, app, validator)
Exemplo n.º 8
0
    def __init__(self, app=None, validator=None, skip_depth=0):
        """Protocol that returns the response object as a html microformat. See
        https://en.wikipedia.org/wiki/Microformats for more info.

        The simple flavour is like the XmlDocument protocol, but returns data in
        <div> or <span> tags.

        :param app: A spyne.application.Application instance.
        :param validator: The validator to use. Ignored.
        :param root_tag: The type of the root tag that encapsulates the return
            data.
        :param child_tag: The type of the tag that encapsulates the fields of
            the returned object.
        :param field_name_attr: The name of the attribute that will contain the
            field names of the complex object children.
        :param field_type_attr: The name of the attribute that will contain the
            type names of the complex object children.
        :param skip_depth: Number of wrapper classes to ignore. This is
            typically one of (0, 1, 2) but higher numbers may also work for your
            case.
        """

        ProtocolBase.__init__(self, app, validator, skip_depth=skip_depth)
Exemplo n.º 9
0
    def __init__(self, app=None, validator=None, skip_depth=0):
        """Protocol that returns the response object as a html microformat. See
        https://en.wikipedia.org/wiki/Microformats for more info.

        The simple flavour is like the XmlDocument protocol, but returns data in
        <div> or <span> tags.

        :param app: A spyne.application.Application instance.
        :param validator: The validator to use. Ignored.
        :param root_tag: The type of the root tag that encapsulates the return
            data.
        :param child_tag: The type of the tag that encapsulates the fields of
            the returned object.
        :param field_name_attr: The name of the attribute that will contain the
            field names of the complex object children.
        :param field_type_attr: The name of the attribute that will contain the
            type names of the complex object children.
        :param skip_depth: Number of wrapper classes to ignore. This is
            typically one of (0, 1, 2) but higher numbers may also work for your
            case.
        """

        ProtocolBase.__init__(self, app, validator, skip_depth=skip_depth)
Exemplo n.º 10
0
    def __init__(self, app=None, validator=None, xml_declaration=True,
                cleanup_namespaces=True, encoding=None, pretty_print=False,
                attribute_defaults=False,
                dtd_validation=False,
                load_dtd=False,
                no_network=True,
                ns_clean=False,
                recover=False,
                remove_blank_text=False,
                remove_pis=True,
                strip_cdata=True,
                resolve_entities=False,
                huge_tree=False,
                compact=True
            ):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration
        self.cleanup_namespaces = cleanup_namespaces
        if encoding is None:
            self.encoding = 'UTF-8'
        else:
            self.encoding = encoding

        self.pretty_print = pretty_print

        self.serialization_handlers = cdict({
            AnyXml: xml_to_parent_element,
            Alias: alias_to_parent_element,
            Fault: fault_to_parent_element,
            AnyDict: dict_to_parent_element,
            AnyHtml: html_to_parent_element,
            EnumBase: enum_to_parent_element,
            ModelBase: base_to_parent_element,
            ByteArray: byte_array_to_parent_element,
            Attachment: attachment_to_parent_element,
            XmlAttribute: xmlattribute_to_parent_element,
            ComplexModelBase: complex_to_parent_element,
        })

        self.deserialization_handlers = cdict({
            AnyXml: xml_from_element,
            Fault: fault_from_element,
            AnyDict: dict_from_element,
            EnumBase: enum_from_element,
            ModelBase: base_from_element,
            Unicode: unicode_from_element,
            ByteArray: byte_array_from_element,
            Attachment: attachment_from_element,
            ComplexModelBase: complex_from_element,

            Alias: alias_from_element,
            Iterable: iterable_from_element,
            Array: array_from_element,
        })

        self.log_messages = (logger.level == logging.DEBUG)
        self.parser_kwargs = dict(
            attribute_defaults=attribute_defaults,
            dtd_validation=dtd_validation,
            load_dtd=load_dtd,
            no_network=no_network,
            ns_clean=ns_clean,
            recover=recover,
            remove_blank_text=remove_blank_text,
            remove_comments=True,
            remove_pis=remove_pis,
            strip_cdata=strip_cdata,
            resolve_entities=resolve_entities,
            huge_tree=huge_tree,
            compact=compact,
            encoding=encoding,
        )
Exemplo n.º 11
0
Arquivo: http.py Projeto: shaung/spyne
    def __init__(self, app=None, validator=None, mime_type=None, tmp_dir=None,
                                                      tmp_delete_on_close=True):
        ProtocolBase.__init__(self, app, validator, mime_type)

        self.tmp_dir = tmp_dir
        self.tmp_delete_on_close = tmp_delete_on_close
Exemplo n.º 12
0
    def __init__(self, app=None):
        ProtocolBase.__init__(self, app, validator=None)

        self.length = 500  # if you change this, you should re-scale the svg file
Exemplo n.º 13
0
    def __init__(self, app=None):
        ProtocolBase.__init__(self, app, validator=None)

        self.length = 500 # if you change this, you should re-scale the svg file