On Aug 15, 2006, at 2:52 PM, Jorge Godoy wrote:
>
> Jonathan LaCour <[EMAIL PROTECTED]> writes:
>
>> I am trying to jsonify a simple dictionary like this:
>>
>>>>> from turbojson.jsonify import jsonify
>>>>>
>>>>> d = {1:'one', 2:'two'}
>>>>> jsonify(d)
>> Traceback (most recent call last):
>> File "<console>", line 1, in ?
>> File "<string>", line 5, in jsonify
>> File "_speedups.pyx", line 376, in
>> _speedups.BaseDispatcher.__getitem__
>> File "/eggs/dispatch/interfaces.py", line 15, in __call__
>> NoApplicableMethods: (({1: 'one', 2: 'two'},), {})
>>
>> Am I crazy, or should this work?
>
>>>> from turbojson import jsonify
>>>> d = {1:'one', 2:'two'}
>>>> jsonify.encode(d)
> '{"1": "one", "2": "two"}'
Which is to say use "encode" instead of "jsonify". simplejson knows
how to handle dicts directly, so it doesn't need the generic function.
Kevin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---