def edit_contact(cid='new'): if cid != 'new': cid = objId(cid) return { 'entry' : entries.find_one({'_id': cid}), 'settings' : settings }
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('/')