Beispiel #1
0
    if not telephoneType:
        lambdaTelephoneType = lambda rec: True
    else:
        telephoneTypes = list(sorted(telephoneDir.telephones.telephoneTypes))
        telephoneTypes.insert(0, 'все')
        t = telephoneTypes[telephoneType]
        lambdaTelephoneType = lambda rec: rec.telephone.type == t
    tmpDir = list(sorted(telephoneDir))
    tmpDir = filter(lambda telephone: lambdaSubdivision(telephone) and \
                                                     lambdaCollaborator(telephone) and \
                                                     lambdaNumber(telephone) and \
                                                     lambdaTelephoneType(telephone), tmpDir)
    print subdivision, telephoneType, collaborator, number
    for r in tmpDir:
        row((r.telephone.number, r.collaborator.code,
             r.collaborator.family.decode("utf-8"),
             r.collaborator.name.decode("utf-8"),
             r.collaborator.patronym.decode("utf-8"),
             find(r.collaborator, telephoneDir.subdivision),
             r.telephone.type.name.decode("utf-8")))

    textdoc.spreadsheet.addElement(table)
    textdoc.save("telephonedir.ods")


if __name__ == '__main__':
    import tdcsv

    telephoneDir = tdcsv.load()
    save(telephoneDir)
Beispiel #2
0
 def export(self):
     import tdcsv
     import tdods
     telephoneDir = tdcsv.load()
     tdods.save(telephoneDir, subdivision, collaborator, number,
                telephoneType)