Beispiel #1
0
def save_email_addresses(addresses_field: Text):
    '''Save email addresses from Text widget'''
    text = addresses_field.get(1.0, END)

    addresses = [{'email': address.strip()} for address in text.split('\n')]

    Address.delete().where(True).execute()
    Address.insert_many(addresses).execute()
Beispiel #2
0
def load_email_addresses_from_file(field: Text):
    address_records = prepare_email_addresses()
    Address.delete().where(True).execute()
    field.delete(1.0, END)

    Address.insert_many(address_records).execute()

    load_addresses_to_field(field)
    save_email_addresses(field)