Merge "Add type information to ObjectNotFound message"

This commit is contained in:
Jenkins 2016-06-10 11:52:24 +00:00 committed by Gerrit Code Review
commit 36a3e127c0

View File

@ -56,9 +56,9 @@ def _safe_get_object(context, model, **kwargs):
db_obj = get_object(context, model, **kwargs)
if db_obj is None:
key = "".join(['%s:: %s ' % (key, value) for (key, value)
in kwargs.items()])
raise n_exc.ObjectNotFound(id=key)
key = ", ".join(['%s=%s' % (key, value) for (key, value)
in kwargs.items()])
raise n_exc.ObjectNotFound(id="%s(%s)" % (model.__name__, key))
return db_obj