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
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)
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)), ]
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 }
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
class Action(ComplexModel): class Attributes(ComplexModel.Attributes): sub_ns = "SOME_NS" sub_name = "Action" data = XmlData(Unicode) must_understand = XmlAttribute(Unicode)
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
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), ]
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)
class C(ComplexModel): a = XmlData(Unicode) b = XmlAttribute(Unicode)
class HoldRequests(Tr069ComplexModel): _type_info = odict() _type_info["mustUnderstand"] = XmlAttribute(String, ns=SOAP_ENV) _type_info["Data"] = XmlData(Boolean)
class ProductEdition(ComplexModel): __namespace__ = 'kickass_namespace' id = XmlAttribute(Uuid) name = XmlData(Unicode)
class SomeClass(NewTableModel): __tablename__ = 'some_class' __table_args__ = {"sqlite_autoincrement": True} i = XmlAttribute(Integer32(pk=True)) s = XmlData(Unicode(64))