Remove DictCompat from S3 object
This changes over uses of dict syntax with the S3 object to use object syntax. Change-Id: I3a6c016440a7105498e417e56efb07099b76e7d5 Partially-Implements: bp rm-object-dict-compat-newton
This commit is contained in:
parent
d57a4e8be9
commit
c5626a2600
@ -136,10 +136,8 @@ class EC2SnapshotMapping(base.NovaPersistentObject, base.NovaObject):
|
||||
return cls._from_db_object(context, cls(context), db_smap)
|
||||
|
||||
|
||||
# TODO(berrange): Remove NovaObjectDictCompat
|
||||
@base.NovaObjectRegistry.register
|
||||
class S3ImageMapping(base.NovaPersistentObject, base.NovaObject,
|
||||
base.NovaObjectDictCompat):
|
||||
class S3ImageMapping(base.NovaPersistentObject, base.NovaObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
@ -151,7 +149,7 @@ class S3ImageMapping(base.NovaPersistentObject, base.NovaObject,
|
||||
@staticmethod
|
||||
def _from_db_object(context, s3imap, db_s3imap):
|
||||
for field in s3imap.fields:
|
||||
s3imap[field] = db_s3imap[field]
|
||||
setattr(s3imap, field, db_s3imap[field])
|
||||
s3imap._context = context
|
||||
s3imap.obj_reset_changes()
|
||||
return s3imap
|
||||
|
@ -157,7 +157,7 @@ class _TestS3ImageMapping(object):
|
||||
@staticmethod
|
||||
def _compare(test, db, obj):
|
||||
for field, value in db.items():
|
||||
test.assertEqual(db[field], obj[field])
|
||||
test.assertEqual(db[field], getattr(obj, field))
|
||||
|
||||
def test_create(self):
|
||||
s3imap = ec2_obj.S3ImageMapping(context=self.context)
|
||||
|
Loading…
x
Reference in New Issue
Block a user