b3d70 schrieb: > Hi all, > > I'm newbie to python world. No experience on turbogears. > Please forgive me if anyone ever ask this matter before. > > I have query result set, which I want to turn it into json, either > using simplejson or turbojson. This is part of my code : > > currencies_rs = DBSession.query(Currencies) > return dict(simplejson.dumps(currencies_rs) ) > > I got error messages, and try to figure it out by read it on google, > but since I have no experience with python, it turns me more confuse. > So, please anyone could help me ?
First of all, you don't need to do the dumps yourself. The returned dict should be converted automatically. Second, if you get errors, you need to show these to us - how else are we supposed to help you? In Harry Potter, people can use crystal balls to read minds and stacktraces - here, outside hogwarts, we need this information. And as last point, dictionaries can't be created from a single string. Either use dict(key=value) or dict([(key1, value1), (key2, value2), ...]) 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 -~----------~----~----~----~------~----~------~--~---

