Changed to_dict to call all callable values when their key is in field_names.
This is useful for instance when exporting role instances and you want to export document_name.
--- a/app/soc/models/base.py Wed Aug 12 15:44:18 2009 -0700
+++ b/app/soc/models/base.py Thu Aug 13 10:23:31 2009 -0700
@@ -22,6 +22,7 @@
__authors__ = [
'"Todd Larsen" <tlarsen@google.com>',
+ '"Lennard de Rijk" <ljvderijk@gmail.com>',
]
@@ -68,12 +69,12 @@
if not hasattr(self, key):
continue
- result[key] = getattr(self, key)
+ value = getattr(self, key)
- if hasattr(self, 'name'):
- name_prop = getattr(self, 'name')
- if callable(name_prop):
- result['name'] = name_prop()
+ if callable(value):
+ value = value()
+
+ result[key] = value
return result