Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import functools
- from decimal import Decimal
- from json import JSONEncoder
- def wrap_default(real_default):
- @functools.wraps(real_default)
- def wrapper(self, obj):
- print "aaa"
- if isinstance(obj, Decimal):
- return float(obj)
- return real_default(self, obj)
- return wrapper
- JSONEncoder.default = wrap_default(JSONEncoder.default)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement