diff --git a/deluge/common.py b/deluge/common.py index 904a9d05c..463c5f90b 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -29,6 +29,12 @@ import os import time import subprocess import platform +import sys + +if sys.version_info > (2, 6): + import json +else: + import simplejson as json import pkg_resources import xdg, xdg.BaseDirectory diff --git a/deluge/config.py b/deluge/config.py index 0e3daa86a..52b22c6a4 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -30,16 +30,12 @@ Deluge Config Module import cPickle as pickle import shutil import os -import sys - -if sys.version_info > (2, 6): - import json -else: - import simplejson as json import deluge.common from deluge.log import LOG as log +json = deluge.common.json + def prop(func): """Function decorator for defining property attributes diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 6205cb89d..32504b5ec 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -23,7 +23,6 @@ # import os -import sys import time import locale import shutil @@ -34,11 +33,6 @@ import logging import tempfile import pkg_resources -if sys.version_info > (2, 6): - import json -else: - import simplejson as json - from twisted.application import service, internet from twisted.internet.defer import Deferred from twisted.web import http, resource, server, static @@ -52,6 +46,7 @@ from deluge.ui import common as uicommon from deluge.ui.client import client, Client from deluge.ui.tracker_icons import TrackerIcons log = logging.getLogger(__name__) +json = common.json # Initialize gettext try: