diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-08 16:02:24 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-08 16:02:24 +0000 |
| commit | 5c4e9dbcadef9a41396d78a1bfc4728db5cd55eb (patch) | |
| tree | 77c055c8c7f6c5fdb3506fa488db8b922cf733eb /keystone/common | |
| parent | 629c1f9ea6931cad51a3a5898799811c971cd517 (diff) | |
| parent | 2eea4553e23ff3c0d4d367316ea634253e11c10a (diff) | |
Merge "Include 'extra' attributes twice (bug 1076120)"
Diffstat (limited to 'keystone/common')
| -rw-r--r-- | keystone/common/sql/core.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py index c18bf83d..0bd0000d 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): |
