# HG changeset patch # User Lennard de Rijk # Date 1250184211 25200 # Node ID 4011d44ba0b6061e59b1eccaf64072c762320bbb # Parent 93e4745ebdbd19bbd9379b42ce90fb6e66afea31 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. diff -r 93e4745ebdbd -r 4011d44ba0b6 app/soc/models/base.py --- 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" ', + '"Lennard de Rijk" ', ] @@ -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