Ejemplo n.º 1
0
Archivo: _base.py Proyecto: rch/rpclib
    def __init__(self, app=None, validator=None, xml_declaration=True):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration

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

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

        self.log_messages = logger.level == logging.DEBUG
Ejemplo n.º 2
0
Archivo: _base.py Proyecto: rch/rpclib
    def __init__(self, app=None, validator=None, xml_declaration=True):
        ProtocolBase.__init__(self, app, validator)
        self.xml_declaration = xml_declaration

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

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

            Array: array_from_element,
            Iterable: iterable_from_element,
        })

        self.log_messages = (logger.level == logging.DEBUG)
Ejemplo n.º 3
0
Archivo: _base.py Proyecto: rch/rpclib
    def set_app(self, value):
        ProtocolBase.set_app(self, value)

        self.validation_schema = None

        if value:
            from rpclib.interface.wsdl import Wsdl11

            wsdl = Wsdl11(value)
            wsdl.build_validation_schema()

            self.validation_schema = wsdl.validation_schema
Ejemplo n.º 4
0
    def set_app(self, value):
        ProtocolBase.set_app(self, value)

        self.validation_schema = None

        if value:
            from rpclib.interface.xml_schema import XmlSchema

            wsdl = XmlSchema(value.interface)
            wsdl.build_validation_schema()

            self.validation_schema = wsdl.validation_schema
Ejemplo n.º 5
0
Archivo: _base.py Proyecto: rch/rpclib
    def set_app(self, value):
        ProtocolBase.set_app(self, value)

        self.validation_schema = None

        if value:
            from rpclib.interface.wsdl import Wsdl11

            wsdl = Wsdl11(value)
            wsdl.build_validation_schema()

            self.validation_schema = wsdl.validation_schema
Ejemplo n.º 6
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 XmlObject protocol, but returns data in
        <div> or <span> tags.

        :param app: A rpclib.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)
Ejemplo n.º 7
0
    def __init__(self, app=None, validator=None, root_tag='div',
            child_tag='div', field_name_attr='class'):
        """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 XmlObject protocol, but returns data in
        <div> or <span> tags.

        :param app: A rpclib.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)

        assert root_tag in ('div','span')
        assert child_tag in ('div','span')
        assert field_name_attr in ('class','id')

        self.__root_tag = root_tag
        self.__child_tag = child_tag
        self.__field_name_attr = field_name_attr

        self.__serialization_handlers = cdict({
            ModelBase: serialize_model_base,
            ByteArray: not_supported,
            Attachment: not_supported,
            ComplexModelBase: serialize_complex_model,
        })
Ejemplo n.º 8
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
Ejemplo n.º 9
0
    def __init__(self, app=None, validator=None, tmp_dir=None, tmp_delete_on_close=True):
        ProtocolBase.__init__(self, app, validator)

        self.tmp_dir = tmp_dir
        self.tmp_delete_on_close = tmp_delete_on_close
Ejemplo n.º 10
0
    def reconstruct_wsgi_request(self, http_env):
        http_payload, charset = ProtocolBase.reconstruct_wsgi_request(self, http_env)

        content_type = cgi.parse_header(http_env.get("CONTENT_TYPE"))

        return collapse_swa(content_type, http_payload), charset
Ejemplo n.º 11
0
    def __init__(self, parent):
        ProtocolBase.__init__(self, parent)

        self.in_wrapper = Soap11.IN_WRAPPER
        self.out_wrapper = Soap11.OUT_WRAPPER