예제 #1
0
def edit_contact(cid='new'):
    if cid != 'new':
        cid = objId(cid)
    return {
        'entry' : entries.find_one({'_id': cid}),
        'settings' : settings
        }
예제 #2
0
def save_contact():
    contact = {}
    for k,v in request.forms.iterallitems():
        if (k,v) != ('_id', 'new'):
            contact[k] = v
        if '_id' in contact:
            contact['_id'] = objId(contact['_id'])
    entries.save(contact)
    redirect('/')