Remove dict-compat from the zun_service obj

This patch removes the need of having dict-compat for
the zun service object.

Change-Id: I8ef3edb1833352f2543a1bd138ca5fcf4e26ebd4
Partially-Implements: blueprint rm-object-dict-compat
This commit is contained in:
Sudipta Biswas 2016-12-12 11:20:11 +05:30
parent 5a899b6091
commit 8fe32f01f3

View File

@ -17,8 +17,8 @@ from zun.objects import base
@base.ZunObjectRegistry.register @base.ZunObjectRegistry.register
class ZunService(base.ZunPersistentObject, base.ZunObject, class ZunService(base.ZunPersistentObject, base.ZunObject):
base.ZunObjectDictCompat):
# Version 1.0: Initial version # Version 1.0: Initial version
VERSION = '1.0' VERSION = '1.0'
@ -37,7 +37,7 @@ class ZunService(base.ZunPersistentObject, base.ZunObject,
def _from_db_object(zun_service, db_zun_service): def _from_db_object(zun_service, db_zun_service):
"""Converts a database entity to a formal object.""" """Converts a database entity to a formal object."""
for field in zun_service.fields: for field in zun_service.fields:
zun_service[field] = db_zun_service[field] setattr(zun_service, field, db_zun_service[field])
zun_service.obj_reset_changes() zun_service.obj_reset_changes()
return zun_service return zun_service