예제 #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()
예제 #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)
예제 #3
0
    def delete(self, address_uuid):
        result = Address.delete().where(
            Address.user == auth.current_user,
            Address.uuid == address_uuid,
        ).execute()

        if result == 0:
            return None, NOT_FOUND

        return None, NO_CONTENT
예제 #4
0
 def setup_method(self):
     Address.delete().execute()