示例#1
0
class TijdstipMetIndicator(ComplexModel):
    """
    In the XSD TijdstipMetIndicator extends from Tijdstip_e
    """
    __namespace__ = STUF_XML_NS
    __type_name__ = 'TijdstipMetIndicator'
    # __extends__ = Tijdstip_e
    _type_info = element + [
        ('indOnvolledigeDatum', indOnvolledigeDatum),
        ('data', XmlData(simple_types.Tijdstip))
    ]

    @classmethod
    def to_django_value(cls, spyne_obj, django_field):
        if spyne_obj.data is None:
            return ''
        return '{}'.format(spyne_obj.data)

    @classmethod
    def to_spyne_value(cls, django_obj, spyne_field):
        if django_obj is None:
            return None
        # TODO [TECH]: implement indOnvolledigeDatum support
        return {
            'data': django_obj
        }

    @classmethod
    def django_field_type(cls):
        return StUFDateTimeField
示例#2
0
class ID(Tr069ComplexModel):
    # Note: for some reason, XmlAttribute/XmlData pairs MUST be ordered, with
    # XmlAttribute coming first. This appears to be a spyne bug (something to do
    # with spyne.interface._base.add_class())
    _type_info = odict()
    _type_info["mustUnderstand"] = XmlAttribute(String, ns=SOAP_ENV)
    _type_info["Data"] = XmlData(String)
示例#3
0
class Authentiek(ComplexModel):
    __namespace__ = BG_XML_NS
    __type_name__ = 'authentiek'
    _type_info = [
        ('data', XmlData(Unicode)),
        ('metagegeven', XmlAttribute(Boolean.customize(__namespace__=STUF_XML_NS, min_occurs=1), ns=STUF_XML_NS)),
    ]
示例#4
0
class Tijdstip_e(ComplexModel):
    __namespace__ = STUF_XML_NS
    __type_name__ = 'Tijdstip_e'
    _type_info = element + [
        ('data', XmlData(simple_types.Tijdstip))
    ]

    class Attributes(ComplexModel.Attributes):
        sub_ns = STUF_XML_NS

    @classmethod
    def to_django_value(cls, spyne_obj, django_field):
        if spyne_obj.data is None:
            return ''
        return '{}'.format(spyne_obj.data)

    @classmethod
    def to_spyne_value(cls, django_obj, spyne_field):
        if django_obj is None:
            return None

        # TODO [TECH]: implement indOnvolledigeDatum support
        return {
            'data': django_obj
        }
示例#5
0
class DatumMetIndicator(ComplexModel):
    __namespace__ = STUF_XML_NS
    __type_name__ = 'DatumMetIndicator'
    _type_info = element + [
        ('indOnvolledigeDatum', indOnvolledigeDatum),
        ('data', XmlData(Unicode)),
    ]

    @classmethod
    def to_django_value(cls, spyne_obj, django_field):
        if spyne_obj.data is None:
            return ''
        return '{}'.format(spyne_obj.data)

    @classmethod
    def to_spyne_value(cls, django_obj, spyne_field):
        if django_obj is None:
            return None

        # TODO [TECH]: implement indOnvolledigeDatum support
        return {
            'data': django_obj
        }

    @classmethod
    def django_field_type(cls):
        return StUFDateField
示例#6
0
        class Action(ComplexModel):
            class Attributes(ComplexModel.Attributes):
                sub_ns = "SOME_NS"
                sub_name = "Action"

            data = XmlData(Unicode)
            must_understand = XmlAttribute(Unicode)
示例#7
0
class anySimpleType(Tr069ComplexModel):
    """ Type used to transfer simple data of various types. Data type is
        defined in 'type' XML attribute. Data is handled as a string. """
    _type_info = odict()
    _type_info["type"] = XmlAttribute(String, ns=XSI_NS)
    _type_info["Data"] = XmlData(String)

    def __repr__(self):
        """For types we can't resolve only print the datum"""
        return self.Data
示例#8
0
class ExtraElement(ComplexModel):
    __namespace__ = STUF_XML_NS
    __type_name__ = 'ExtraElement'
    _type_info = [
        ('data', XmlData(Unicode)),
        ('noValue', noValue),
        ('exact', exact),
        ('naam', XmlAttribute(Unicode.customize(min_occurs=1))),
        ('indOnvolledigeDatum', indOnvolledigeDatum),
    ]
示例#9
0
class BinaireInhoud(ComplexModel):
    __namespace__ = STUF_XML_NS
    __type_name__ = 'BinaireInhoud'
    _type_info = [
        ('data', XmlData(File)),
        ('bestandsnaam', XmlAttribute(attributes.Bestandsnaam, ref='bestandsnaam', ns=STUF_XML_NS)),
        ('contentType', XmlAttribute(attributes.ContentType, ref='contentType', ns=XMIME_XML_NS)),
    ]

    def to_cmis(self) -> BytesIO:
        if self.data is None:
            return None

        self.data.rollover()
        self.data.handle.seek(0)
        encoded = self.data.handle.read()
        return BytesIO(encoded)
示例#10
0
文件: test_xml.py 项目: zhuhj89/spyne
 class C(ComplexModel):
     a = XmlData(Unicode)
     b = XmlAttribute(Unicode)
示例#11
0
class HoldRequests(Tr069ComplexModel):
    _type_info = odict()
    _type_info["mustUnderstand"] = XmlAttribute(String, ns=SOAP_ENV)
    _type_info["Data"] = XmlData(Boolean)
示例#12
0
文件: utils.py 项目: fmezas/spyne
class ProductEdition(ComplexModel):
    __namespace__ = 'kickass_namespace'

    id = XmlAttribute(Uuid)
    name = XmlData(Unicode)
示例#13
0
        class SomeClass(NewTableModel):
            __tablename__ = 'some_class'
            __table_args__ = {"sqlite_autoincrement": True}

            i = XmlAttribute(Integer32(pk=True))
            s = XmlData(Unicode(64))