From 2eea4553e23ff3c0d4d367316ea634253e11c10a Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Wed, 7 Nov 2012 15:17:52 -0600 Subject: Include 'extra' attributes twice (bug 1076120) In order to maintain backwards-compatibility with the output of the previously-broken SQL driver, non-indexed attributes are included in the update user/tenant response in both the correct and expected locations. Change-Id: I54f69c0c4cb3ade349190bc0c61539dcc1846267 --- keystone/common/sql/core.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'keystone/common') diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py index 1a9d595f..d8e11c3a 100644 --- a/keystone/common/sql/core.py +++ b/keystone/common/sql/core.py @@ -68,10 +68,21 @@ class DictBase(object): return cls(**new_d) - def to_dict(self): + def to_dict(self, include_extra_dict=False): + """Returns the model's attributes as a dictionary. + + If include_extra_dict is True, 'extra' attributes are literally + included in the resulting dictionary twice, for backwards-compatibility + with a broken implementation. + + """ d = self.extra.copy() for attr in self.__class__.attributes: d[attr] = getattr(self, attr) + + if include_extra_dict: + d['extra'] = self.extra.copy() + return d def __setitem__(self, key, value): -- cgit