Permalink
Browse files

Better hierarchy for importing JSON. Simplejson is faster than the bu…

…ilt in "json" due to the compiled C _speedups module.
  • Loading branch information...
1 parent 5e1df27 commit e63e64ddfc469a3962fe7920bdcdcb54055da086 @mattrobenolt mattrobenolt committed Mar 13, 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 e63e64d

Please sign in to comment.