Make it possible to retrieve all properties in toDict
We used to retrieve only the properties that are specified in the
self.properties() dictionary, instead, we now iterate over the
key_fields and only use self.properties() if those are not specified.
Patch by: Sverre Rabbelier
--- a/app/soc/models/base.py Thu Apr 02 23:05:56 2009 +0000
+++ b/app/soc/models/base.py Thu Apr 02 23:06:15 2009 +0000
@@ -58,14 +58,14 @@
"""
result = {}
- props = self.properties()
if not field_names:
+ props = self.properties()
field_names = [k for k, v in props.iteritems() if isinstance(v, self.DICT_TYPES)]
- for key, value in props.iteritems():
+ for key in field_names:
# Skip everything that is not valid
- if key not in field_names:
+ if not hasattr(self, key):
continue
result[key] = getattr(self, key)