jfr jr wrote:
> I am not sure this is the best way to fix my issue with serializing
> elixir objects as JSON but it appears to be working. Any input or
> comments??
Wouldn't it be easier just to simply take advantage of the TurboJSON
jsonify generic function? In your json.py module in your project:
from turbojson.jsonify import jsonify
from elixir import Entity
@jsonify.when('isinstance(obj, Entity)')
def jsonify_entity(obj):
result = {}
for name in obj.c.keys():
result[name] = getattr(obj, name)
return result
Thats what TurboJSON is there for :)
--
Jonathan LaCour
http://cleverdevil.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---