Exemple #1
0
def load_obj_record(rec):

    if CURRENT_MODE == '1':
        return pb.Record(pb.Name(rec['name']), pb.Email(rec['email']),
                         pb.Address(rec['address']),
                         pb.Birthday(rec['birthday']),
                         *(pb.Phone(i) for i in rec['phones']))
    elif CURRENT_MODE == '2':
        return nb.NoteRecord(nb.Note(rec['Note']), nb.Teg(rec['Teg']))
Exemple #2
0
def add_contact(*args):

    ab = loadAB()

    name = input_name()

    address = pb.Address(input('Contact address (optional): '))

    phone = input_phone()

    birthday = input_birthday()

    email = input_email()

    record = pb.Record(name, address, phone, birthday, email)
    confirm = input(f'Add record {record} to address book (y/n)?: ')
    if confirm.lower() == 'y':
        ab.add_record(record)
        pb.save_addressBook(ab)
Exemple #3
0
def input_address():
    return pb.Address(input('New address: '))