def create(serial_number, model, name="", customer=1): new_installation = dict() new_installation['serial_number'] = serial_number new_installation['model'] = model new_installation['name'] = name new_installation['customer'] = customer installation = get(serial_number) if installation: installation['customer'] = customer installation['model'] = model installation['name'] = name return Installations_dao.update(installation) return Installations_dao.create(new_installation)
def update_installation(installation): res = None if get(installation.get('serial_number')): res = Installations_dao.update(installation) return res