# HG changeset patch # User Sverre Rabbelier # Date 1238713575 0 # Node ID 4037b147ed106c72d506e203620400bf3294d476 # Parent 773b13d8630905c0c0ef83bd6af0b4ee24f16a37 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 diff -r 773b13d86309 -r 4037b147ed10 app/soc/models/base.py --- 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)