def export(flg_ids, stichtag, mail):
    """This should be the "shared" export function.
    """
    from z3c.saconfig import Session
    session = Session()
    book, adressen, rc = getXLSBases()
    flg_ids = [x for x in flg_ids]
    createRows(session, rc, flg_ids, stichtag)
    fn = "/tmp/fortbildung_%s.csv" % stichtag.strftime('%Y_%m_%d') 
    #for z, line in enumerate(rc):
    #    tt= [unicode(cell).encode('utf-8') for cell in line]
    #    print ';'.join(tt)
    #    print line
    #    adressen.append([cell for cell in line])
    #print "Writing File %s" % fn
    #book.save(fn)
    import csv
    with open(fn, 'wb') as csvfile:
        writer = UnicodeWriter(csvfile)
        for line in rc:
            writer.writerow(line)
    fn = makeZipFile(fn)
    text=u"Bitte öffen Sie die Datei im Anhang"
    import transaction
    with transaction.manager:
        send_mail('*****@*****.**', (mail,), "Versandliste Fortbildung", text, [fn,])
    return fn
def export(flg_id, dateiname, mail):
    """This should be the "shared" export function.
    """
    session = Session()
    book, adressen = getXLSBases()
    createSpalten(adressen)
    createRows(book, adressen, session, flg_id)
    fn = "/tmp/%s" % dateiname
    xls_file = open(fn, 'w+')
    book.save(xls_file)
    xls_file.close()
    fn = makeZipFile(fn)
    text=u"Bitte öffen Sie die Datei im Anhang"
    import transaction
    with transaction.manager as tm:
        send_mail('*****@*****.**', (mail,), "Fortbildung Datenquelle", text, [fn,])
    return fn
Example #3
0
def export(flg_id, mail):
    """This should be the "shared" export function.
    """
    from z3c.saconfig import Session
    session = Session()
    fn = "/tmp/statusliste_%s.xlsx" % flg_id
    book, adressen, rc = getXLSBases()
    createRows(rc, session, flg_id)
    with open(fn, 'wb') as csvfile:
        writer = UnicodeWriter(csvfile)
        for line in rc:
            writer.writerow(line)
    fn = makeZipFile(fn)
    text=u"Bitte öffen Sie die Datei im Anhang"
    import transaction
    with transaction.manager:
        send_mail('*****@*****.**', (mail,), "Statusliste", text, [fn,])
    return fn