From 91d3299280a57a6780c446c21a506f6259552c0a Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Wed, 30 Nov 2016 12:32:47 +0100 Subject: Fix date and datetime export to JSON in Python versions with a json package Python without a json package will use omnijson and fail on date and datetime objects. Added unit tests. --- tablib/formats/_json.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tablib') diff --git a/tablib/formats/_json.py b/tablib/formats/_json.py index 777040a..fb66745 100644 --- a/tablib/formats/_json.py +++ b/tablib/formats/_json.py @@ -5,8 +5,10 @@ import tablib -import sys -from tablib.packages import omnijson as json +try: + import json +except ImportError: + from tablib.packages import omnijson as json title = 'json' -- cgit v1.2.1