Fixes for keypairs model

* Fixed serialization of keypair list
* Removed unneeded overloads of NotImplemented for xml serialization

Change-Id: I64b925a0dc46c5a58fb94ec52c7ffb062386a77b
This commit is contained in:
Daryl Walleck
2013-06-04 14:51:48 -05:00
parent f59fa9c978
commit 368229bbe3

View File

@@ -37,7 +37,7 @@ class Keypair(AutoMarshallingModel):
@classmethod
def _json_to_obj(cls, serialized_str):
json_dict = json.loads(serialized_str)
return cls._dict_to_obj(json_dict.get(cls.ROOT_TAG))
return cls._dict_to_obj(json_dict.get('keypair'))
@classmethod
def _dict_to_obj(cls, json_dict):
@@ -45,14 +45,6 @@ class Keypair(AutoMarshallingModel):
json_dict.get('name'),
json_dict.get('fingerprint'))
@classmethod
def _xml_to_obj(cls, serialized_str):
raise NotImplemented
@classmethod
def _xml_ele_to_obj(cls, xml_ele):
raise NotImplemented
def __eq__(self, other):
"""
@summary: Overrides the default equals
@@ -76,10 +68,6 @@ class Keypair(AutoMarshallingModel):
class Keypairs(Keypair):
@classmethod
def _xml_to_obj(cls, serialized_str):
raise NotImplemented
@classmethod
def _json_to_obj(cls, serialized_str):
ret = []
@@ -87,6 +75,7 @@ class Keypairs(Keypair):
key_list = json_dict.get('keypairs')
for key in key_list:
key = key.get('keypair')
ret.append(Keypair(key.get('public_key'),
key.get('name'),
key.get('fingerprint')))