def _safe_get_object(context, model, id): db_obj = get_object(context, model, id=id) if db_obj is None: raise n_exc.ObjectNotFound(id=id) return db_obj
def _safe_get_object(context, model, id, key='id'): db_obj = get_object(context, model, **{key: id}) if db_obj is None: raise n_exc.ObjectNotFound(id=id) return db_obj