summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchipx86 <chipx86@5efc13c4-1f27-0410-8691-ff2d1f55687e>2009-06-12 09:21:17 +0000
committerchipx86 <chipx86@5efc13c4-1f27-0410-8691-ff2d1f55687e>2009-06-12 09:21:17 +0000
commit800a8edf576c2b4fa59c5796ee7aa74cc0da5c4d (patch)
treeb6e5b9b500cb7644289fe1480b9bd83f4b82be8b
parent464cc87c7d2e83f3dacb7848e9d67c05d2720d96 (diff)
Use 'json' module if it's available.
simplejson is now part of the Python standard library, but it's named 'json'. This change alters post-review to use it if it's available, which reduces the amount of stuff people have to install (if they have Python 2.6+) Committing on behalf of David. Reviewed http://reviews.review-board.org/r/887/
-rwxr-xr-xscripts/post-review8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/post-review b/scripts/post-review
index 6990b50..fb65e41 100755
--- a/scripts/post-review
+++ b/scripts/post-review
@@ -7,7 +7,6 @@ import mimetools
import ntpath
import os
import re
-import simplejson
import socket
import stat
import subprocess
@@ -25,6 +24,11 @@ except ImportError:
# Support Python versions before 2.5.
from md5 import md5
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
# This specific import is necessary to handle the paths for
# cygwin enabled machines.
if (sys.platform.startswith('win')
@@ -478,7 +482,7 @@ class ReviewBoardServer(object):
Loads in a JSON file and returns the data if successful. On failure,
APIError is raised.
"""
- rsp = simplejson.loads(data)
+ rsp = json.loads(data)
if rsp['stat'] == 'fail':
raise APIError, rsp