On Apr 30, 2009, at 5:13 AM, Uwe Feldtmann wrote:
> Thanks Domhnall.
>
> Not sure if it will help as I'm using the jsonify decorator on a
> method in the controller and it is what is failing when attempting
> to wrap the result set.
>
Unfortunately our @jsonify just sucks in that you can't specify args
to dumps. Otherwise this would be even slightly easier than Domhnall's
example:
# Don't even need a subclass
def myenc(d):
if if isinstance(d, decimal.Decimal):
return float(str(d)
# etc
raise TypeError()
simplejson.dumps(data, default=myenc)
We need to fix jsonify -- what's a little problematic is it's built to
take no arguments, which is significantly different from a decorator
that's built to take arguments. We may be able to make the decorator
work both ways for 0.10 but it'd tricky/annoying.
Pylons 1.0 could definitely break it, however: @jsonify -> @jsonify()
--
Philip Jenvey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---