Permalink
Browse files

Merge pull request #20 from mattrobenolt/prefer-simplejson

Better hierarchy for importing JSON. Simplejson is faster than the builtin "json" due to the compiled C _speedups module.
  • Loading branch information...
2 parents 5e1df27 + e63e64d commit 52977a7477cee131a402ffd8bf4dd87280182b9e @themartorana committed May 31, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 postmark/core.py
View
@@ -19,12 +19,16 @@
import httplib
try:
- import json
+ import simplejson as json
except ImportError:
try:
- import simplejson as json
+ import json
except ImportError:
- raise Exception('Cannot use python-postmark library without Python 2.6 or greater, or Python 2.4 or 2.5 and the "simplejson" library')
+ try:
+ # Last ditch effort to try and grab it from Django if they're using Django
+ from django.utils import simplejson as json
+ except ImportError:
+ raise Exception('Cannot use python-postmark library without Python 2.6 or greater, or Python 2.4 or 2.5 and the "simplejson" library')
class PMJSONEncoder(json.JSONEncoder):
def default(self, o):

0 comments on commit 52977a7

Please sign in to comment.