From 20d4f961b68c2848b40b8f8b7061b4d1bc9082bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= Date: Tue, 10 Sep 2013 23:12:46 +0200 Subject: [PATCH] use stdlib's json module if simplejson is missing json is available in Python >= 2.6 --- fabfile.py | 5 ++++- filedict.py | 5 ++++- menu.py | 5 ++++- modules/installed/lib/user_store.py | 5 ++++- modules/installed/santiago/santiago.py | 5 ++++- modules/installed/system/config.py | 5 ++++- modules/installed/system/expert_mode.py | 5 ++++- modules/installed/system/system.py | 5 ++++- modules/installed/system/wan.py | 5 ++++- 9 files changed, 36 insertions(+), 9 deletions(-) diff --git a/fabfile.py b/fabfile.py index 4b4d25410..a9a95d09c 100644 --- a/fabfile.py +++ b/fabfile.py @@ -7,7 +7,10 @@ # plinth box import os,sys, subprocess -import simplejson as json +try: + import simplejson as json +except ImportError: + import json import fabric.api from fabric.api import local, env, cd, put, get, task diff --git a/filedict.py b/filedict.py index 1e76d67da..d4f9a35ad 100644 --- a/filedict.py +++ b/filedict.py @@ -5,7 +5,10 @@ Author: Erez Shinan Date : 31-May-2009 """ -import simplejson as json ## jlv replaced pickle with json +try: + import simplejson as json ## jlv replaced pickle with json +except ImportError: + import json import UserDict ##import cPickle as pickle diff --git a/menu.py b/menu.py index 79f220537..90b0af896 100644 --- a/menu.py +++ b/menu.py @@ -1,5 +1,8 @@ -import simplejson as json from urlparse import urlparse +try: + import simplejson as json +except ImportError: + import json import cherrypy import cfg diff --git a/modules/installed/lib/user_store.py b/modules/installed/lib/user_store.py index 236b73a8f..f8ece84e7 100644 --- a/modules/installed/lib/user_store.py +++ b/modules/installed/lib/user_store.py @@ -1,5 +1,8 @@ import os -import simplejson as json +try: + import simplejson as json +except ImportError: + import json import cherrypy import cfg from model import User diff --git a/modules/installed/santiago/santiago.py b/modules/installed/santiago/santiago.py index 7cf11e538..6d179c50b 100644 --- a/modules/installed/santiago/santiago.py +++ b/modules/installed/santiago/santiago.py @@ -7,7 +7,10 @@ haven't figured that one all the way through yet. import os, sys import cherrypy -import simplejson as json +try: + import simplejson as json +except ImportError: + import json from gettext import gettext as _ from plugin_mount import PagePlugin from modules.auth import require diff --git a/modules/installed/system/config.py b/modules/installed/system/config.py index b671fcc12..a987a0394 100644 --- a/modules/installed/system/config.py +++ b/modules/installed/system/config.py @@ -1,7 +1,10 @@ import os, subprocess from socket import gethostname import cherrypy -import simplejson as json +try: + import simplejson as json +except ImportError: + import json from gettext import gettext as _ from filedict import FileDict from modules.auth import require diff --git a/modules/installed/system/expert_mode.py b/modules/installed/system/expert_mode.py index da8dbc5aa..e69e08bcf 100644 --- a/modules/installed/system/expert_mode.py +++ b/modules/installed/system/expert_mode.py @@ -1,6 +1,9 @@ import os import cherrypy -import simplejson as json +try: + import simplejson as json +except ImportError: + import json from gettext import gettext as _ from filedict import FileDict from modules.auth import require diff --git a/modules/installed/system/system.py b/modules/installed/system/system.py index 68a7a50ff..eba279a90 100644 --- a/modules/installed/system/system.py +++ b/modules/installed/system/system.py @@ -1,6 +1,9 @@ import os import cherrypy -import simplejson as json +try: + import simplejson as json +except ImportError: + import json from gettext import gettext as _ from filedict import FileDict from auth import require diff --git a/modules/installed/system/wan.py b/modules/installed/system/wan.py index 0817f62c4..394f67d6e 100644 --- a/modules/installed/system/wan.py +++ b/modules/installed/system/wan.py @@ -1,6 +1,9 @@ import os import cherrypy -import simplejson as json +try: + import simplejson as json +except ImportError: + import json from gettext import gettext as _ from filedict import FileDict from modules.auth import require