コード例 #1
0
class activelock(_davbase):
    """XML model for an activelock response message."""
    lockscope = fields.Model("lockscope")
    locktype = fields.Model("locktype")
    depth = fields.String(tagname="depth")
    owner = fields.XmlNode(tagname="owner", encoding="UTF-8", required=False)
    timeout = TimeoutField(required=False)
    locktoken = fields.Model("locktoken", required=False)
コード例 #2
0
ファイル: dhst_cli.py プロジェクト: sc4ryb3ar/bugfree-tribble
class results(dexml.Model):
    method = fields.String(tagname='method')
    response = fields.String(tagname='response',required=False)
    token = fields.String(tagname='token',required=False)
    file_infos = fields.List(fields.Model(file_info),required=False)
    folder_info = fields.Model(folder_info, required=False)
    folders = fields.List("folder_info", tagname="folders", required=False)
    files = fields.List("file_info", tagname="files", required=False)
コード例 #3
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class PaymentTypeInformation(dexml.Model):
    '''Conjunto de elementos utilizados para especificar con mayor detalle el tipo de operación.'''

    service_level = fields.Model(ServiceLevel)
    local_instrument = fields.Model(LocalInstrument)
    sequence_type = fields.String(tagname="SeqTp")

    def __init__(self):
        self.service_level = ServiceLevel()
        self.local_instrument = LocalInstrument()
        self.sequence_type = "OOFF"

    class meta:
        tagname = "PmtTpInf"
コード例 #4
0
class DirectDebitTransactionInformation(dexml.Model):
    """
    Conjunto de elementos utilizados para proporcionar información sobre cada una de las operaciones individuales
    incluidas en el mensaje.
    """

    payment_identification = fields.Model(PaymentIdentification)
    instructed_amount = fields.Model(InstructedAmount)
    charge_bearer = fields.String(tagname="ChrgBr")
    direct_debit_transaction = fields.Model(DirectDebitTransaction)
    debtor_agent = fields.Model(DebtorAgent)
    debtor = fields.Model(Debtor)
    debtor_account = fields.Model(DebtorAccount)
    remittance_information = fields.Model(RemittanceInformation)

    def __init__(self):
        self.payment_identification = PaymentIdentification()
        self.instructed_amount = InstructedAmount()
        self.charge_bearer = "SLEV"
        self.debtor_agent = DebtorAgent()
        self.debtor = Debtor()
        self.debtor_account = DebtorAccount()
        self.direct_debit_transaction = DirectDebitTransaction()

    class meta:
        tagname = "DrctDbtTxInf"
コード例 #5
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class DirectDebitTransaction(dexml.Model):
    '''Conjunto de elementos que suministran información específica relativa al mandato de adeudo directo.'''

    mandate_related_information = fields.Model(MandateRelatedInformation)

    def __init__(self):
        self.mandate_related_information = MandateRelatedInformation()

    class meta:
        tagname = "DrctDbtTx"
コード例 #6
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class DebtorAccount(dexml.Model):
    '''Identificación inequívoca de la cuenta del deudor donde se cargará el adeudo directo (AT-07).'''

    identification = fields.Model(Identification)

    def __init__(self):
        self.identification = Identification()

    class meta:
        tagname = "DbtrAcct"
コード例 #7
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class CreditorSchemeIdentification(dexml.Model):
    '''Identificación del acreedor'''

    identification = fields.Model(Identification_Private)

    def __init__(self):
        self.identification = Identification_Private()

    class  meta(object):
        tagname = "CdtrSchmeId"
コード例 #8
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class Identification_Organisation(dexml.Model):
    '''Identificación única e inequívoca de la parte'''

    organisation_identification = fields.Model(OrganisationIdentification)

    def __init__(self):
        self.organisation_identification = OrganisationIdentification()

    class  meta(object):
        tagname = "Id"
コード例 #9
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class Identification_Private(dexml.Model):
    '''Identificación única e inequívoca de la parte'''

    private_identification = fields.Model(PrivateIdentification)

    def __init__(self):
        self.private_identification = PrivateIdentification()

    class  meta(object):
        tagname = "Id"
コード例 #10
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class OrganisationIdentification(dexml.Model):
    '''Identificación única e inequívoca de una persona jurídica.'''

    other = fields.Model(Other, required=False)

    def __init__(self):
        self.other = Other()

    class meta:
        tagname = "OrgId"
コード例 #11
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class CreditorAgent(dexml.Model):
    '''Entidad de crédito donde el acreedor mantiene su cuenta.'''

    financial_institution_identification = fields.Model(FinancialInstitutionIdentification)

    def __init__(self):
        self.financial_institution_identification = FinancialInstitutionIdentification()

    class meta:
        tagname = "CdtrAgt"
コード例 #12
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class PrivateIdentification(dexml.Model):
    '''Identificación única e inequívoca de la parte'''

    other = fields.Model(Other)

    def __init__(self):
        self.other = Other()

    class  meta(object):
        tagname = "PrvtId"
コード例 #13
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class CreditorAccount(dexml.Model):
    '''Identificación inequívoca de la cuenta del acreedor AT-04.'''

    identification = fields.Model(Identification)

    def __init__(self):
        self.identification = Identification()

    class meta:
        tagname = "CdtrAcct"
コード例 #14
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class InitiatingParty(dexml.Model):
    '''Parte que presenta el mensaje. En el mensaje de presentación, puede ser el “acreedor” o “el presentador”.'''

    name = fields.String(tagname="Nm", required=False)
    # identification = fields.String(tagname="Id", required=False)
    identification = fields.Model(Identification_Organisation)

    def __init__(self):
        self.identification = Identification_Organisation()

    class meta:
        tagname = "InitgPty"
コード例 #15
0
class DebtorAgent(dexml.Model):
    """
    Entidad de crédito donde el deudor mantiene su cuenta (AT-13).
    """

    financial_institution_identification = fields.Model(FinancialInstitutionIdentification)

    def __init__(self):
        self.financial_institution_identification = FinancialInstitutionIdentification()

    class meta:
        tagname = "DbtrAgt"
コード例 #16
0
class PaymentInformation(dexml.Model):
    payment_information_identification = fields.String(tagname="PmtInfId")
    payment_method = fields.String(tagname="PmtMtd")
    payment_type_information =  fields.Model(PaymentTypeInformation)
    requested_collection_date = fields.String(tagname="ReqdColltnDt")
    creditor = fields.Model(Creditor)
    creditor_account = fields.Model(CreditorAccount)
    creditor_agent = fields.Model(CreditorAgent)
    creditor_scheme_identification = fields.Model(CreditorSchemeIdentification)
    direct_debit_transaction_information = fields.Model(DirectDebitTransactionInformation)

    def __init__(self, payment_id=None):
        self.payment_type_information = PaymentTypeInformation()
        if not payment_id:
            self.payment_information_identification = generated_id(35)
        self.requested_collection_date = iso_date()
        self.creditor = Creditor()
        self.creditor_account = CreditorAccount()
        self.creditor_agent = CreditorAgent()
        self.direct_debit_transaction_information = DirectDebitTransactionInformation()
        self.creditor_scheme_identification = CreditorSchemeIdentification()
        self.payment_method = "DD"

    def render(self, **kwargs):
        self.payment_information_identification = clean_string(self.payment_information_identification, 35)
        self.requested_collection_date = clean_string(self.requested_collection_date, 2)

        return super(PaymentInformation, self).render(**kwargs)

    class meta:
        tagname = "PmtInf"
コード例 #17
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class CstmrDrctDbtInitn(dexml.Model):
    '''Identifica el tipo de mensaje: iniciación de adeudos directos.'''

    header = fields.Model(GroupHeader)
    # payment_information = fields.Model(PaymentInformation)
    payment_information = fields.List(PaymentInformation)

    def __init__(self):
        self.header = GroupHeader()
        # self.payment_information = PaymentInformation()
        self.payment_information = list()

    class meta:
        tagname = "CstmrDrctDbtInitn"
コード例 #18
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class Document(dexml.Model):
    '''Clase base.'''

    namespaces = """<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:asx="http://www.sap.com/abapxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">"""

    operation = fields.Model(CstmrDrctDbtInitn)

    def __init__(self):
        self.operation = CstmrDrctDbtInitn()

    def render(self, **kwargs):
        return super(Document, self).render(**kwargs).replace('<Document>', self.namespaces)

    class meta:
        tagname = "Document"
コード例 #19
0
class Document(dexml.Model):
    """
    Clase base.
    """

    namespaces = XML_DOCUMENT_NAMESPACE

    operation = fields.Model(CstmrDrctDbtInitn)

    def __init__(self):
        self.operation = CstmrDrctDbtInitn()

    def render(self, **kwargs):
        return super(Document, self).render(**kwargs).replace('<Document>', self.namespaces)

    class meta:
        tagname = "Document"
コード例 #20
0
ファイル: py20022.py プロジェクト: jmorenoamor/py20022
class GroupHeader(dexml.Model):
    '''Conjunto de características compartidas por todas las operaciones incluidas en el mensaje.'''

    message_identification = fields.String(tagname='MsgId')
    creation_date_time = fields.String(tagname='CreDtTm')
    number_of_transactions = fields.String(tagname='NbOfTxs')
    control_sum = fields.Float(tagname="CtrlSum", required=False)
    initiating_party = fields.Model(InitiatingParty)

    def __init__(self):
        self.message_identification = generated_id(35)
        self.creation_date_time = iso_datetime()
        self.initiating_party = InitiatingParty()
        self.number_of_transactions = "1"

    def render(self, **kwargs):
        return super(GroupHeader, self).render(**kwargs)

    class meta:
        tagname = "GrpHdr"
コード例 #21
0
class MainModel(dexml.Model):
    """Basis for main models. Manages automatically the generation timestamp.
    Version "number" and optionnal software information are still to provide."""
    version   = fields.String()
    generated = fields.String() # Could be a date object at some point
    software_used  = fields.Model(Software, required=False)

    def __init__(self,**kwds):
        super(MainModel, self).__init__(**kwds)
        self.version   = "0.3"
        self.generated = datetime.datetime.now().isoformat() # warning: no TZ info here

    def exportToFile(self, filename, pretty_print=False):
        out_str = self.render(encoding="utf-8") # no pretty=pretty_print here, done by lxml
        if pretty_print:
            # lxml pretty print should be way faster than the minidom one used in dexml
            root = etree.fromstring(out_str)
            out_str = etree.tostring(root, xml_declaration=True, encoding='utf-8', pretty_print=True)
        # print "Output file's content:\n%s" % out_str
        with open(os.path.abspath(filename), "wb") as out_f:
            out_f.write(out_str)

    @classmethod 
    def loadFromFile(cls, filename):
        path_file = os.path.abspath(filename)
        if not os.path.isfile(path_file):
            err = "Error: '%s' does not exist or is not a file." % filename
            print(err)
            raise Exception(err)

        # Note: parsing a file directly with dexml/minidom is supposedly slower, si I used lxml one, 
        #       but I did not benchmark it.
        tree = etree.parse(path_file)
        handler = SAX2DOM()
        sax.saxify(tree, handler)
        dom = handler.document

        # In case, you can pass the filename to parse() here to skip lxml
        mdl = cls.parse(dom)
        return mdl
コード例 #22
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class pets(dexml.Model):
     person = fields.Model()
     pets = fields.List("pet",minlength=1)
     notes = fields.List(fields.String(tagname="note"),maxlength=2)
     rewards = fields.List("reward",tagname="rewards",required=False)
コード例 #23
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class obj(dexml.Model):
     items = fields.Dict(fields.Model(item), key = 'name', unique = True)
コード例 #24
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class pets(petbase):
     person = fields.Model()
     pet1 = fields.Model("pet")
     pet2 = fields.Model(pet,required=False)
コード例 #25
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class pets(dexml.Model):
     person = fields.Model()
     pet1 = fields.Model("pet")
     pet2 = fields.Model(pet,required=False)
     pet3 = fields.Model((None,pet),required=False)
     vet = fields.Model((None,"Vet"),required=False)
コード例 #26
0
class lockinfo(_davbase):
    """XML model for a lockinfo response message."""
    lockscope = fields.Model("lockscope")
    locktype = fields.Model("locktype")
    owner = fields.XmlNode(tagname="owner", encoding="UTF-8")
コード例 #27
0
class lockentry(_davbase):
    """XML model for a lockentry response message."""
    lockscope = fields.Model("lockscope")
    locktype = fields.Model("locktype")
コード例 #28
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class B(dexml.Model):
     class meta:
         namespace='http://yyy'
     b = fields.Model(A)
コード例 #29
0
ファイル: test.py プロジェクト: KleKoR/Xsubs.bundle
 class Whoopsie(dexml.Model):
     value = fields.Model("UndefinedModel")
コード例 #30
0
 class obj(dexml.Model):
     fs = fields.List(fields.Model(self.F, tagname="FF"), tagname="L")