summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRune Halvorsen <runefh@gmail.com>2009-06-20 12:16:50 +0200
committerRune Halvorsen <runefh@gmail.com>2009-06-20 12:16:50 +0200
commit8c00c71de736c54c22fedfae86101eb99846ba4f (patch)
tree30003143d0e571e576ab3c6e9e06a86afeeb3cb7
parenta89ad1420af5179bad2d8d6f8b06cd620a41341d (diff)
downloadanyjson-8c00c71de736c54c22fedfae86101eb99846ba4f.tar.gz
Raise our own ImportError if all fails. Looks better than to complain about
django when that happens
-rw-r--r--anyjson.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/anyjson.py b/anyjson.py
index 6b428b6..9fe662f 100644
--- a/anyjson.py
+++ b/anyjson.py
@@ -40,8 +40,12 @@ except ImportError:
serialize = json.dumps
deserialize = json.loads
except ImportError:
- # If all of the above fails, try to fallback to the simplejson
- # embedded in Django.
- from django.utils import simplejson
- serialize = simplejson.dumps
- deserialize = simplejson.loads
+ try:
+ # If all of the above fails, try to fallback to the simplejson
+ # embedded in Django.
+ from django.utils import simplejson
+ serialize = simplejson.dumps
+ deserialize = simplejson.loads
+ except:
+ raise ImportError("No json module found")
+