diff commandparser/command.py @ 9:0069096e8e22

python 2.4 compatability
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 16:45:50 -0700
parents 109627b7db9f
children a3599e4db9a4
line wrap: on
line diff
--- a/commandparser/command.py	Fri Mar 30 10:37:39 2012 -0700
+++ b/commandparser/command.py	Fri Mar 30 16:45:50 2012 -0700
@@ -3,17 +3,21 @@
 """
 
 import inspect
-import json
 import os
 import sys
 from optparse import OptionParser
 from pprint import pprint
 
+try:
+    import json
+except ImportError:
+    import simplejson as json
+
 __all__ = ['Undefined', 'CommandParser']
 
 class Undefined(object):
-  def __init__(self, default):
-    self.default=default
+    def __init__(self, default):
+        self.default=default
 
 class CommandParser(OptionParser):
     # TODO: add `help` command