On Tuesday 03 April 2007 07:12, George Sakkis wrote: > I'm trying to add json to a controller method that works fine when > returning html; when returning json though I get NoApplicableMethods > if the returned dict contains instances of my models. Could the > problem be that my models are based on Elixir/SqlAlchemy and jsonify > doesn't know how to handle them ? If this is the case, shouldn't > there be the same generic mechanism to convert aribitrary objects to > dicts, as it happens when passing them to kid/genshi templates ?
Without you providing the actual traceback, one can only guess... But I'd say yes, that is the reason. For SO there is some generic serialization of model objects, but it only works to a certain extend - it won't serialize any related objects for example. And you are wrong assuming that arbitrary objects are converted when being passed to templates. They are passed as-is. Diez --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

