Merge "create_object should not add an ID if not present in the DB model"

This commit is contained in:
Jenkins 2016-01-28 12:50:15 +00:00 committed by Gerrit Code Review
commit f40538e629

View File

@ -105,7 +105,7 @@ def get_objects(context, model, **kwargs):
def create_object(context, model, values):
with context.session.begin(subtransactions=True):
if 'id' not in values:
if 'id' not in values and hasattr(model, 'id'):
values['id'] = uuidutils.generate_uuid()
db_obj = model(**values)
context.session.add(db_obj)