From f12f02fff84ca5553bd8d59e6ee780c8e25cbb7c Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 9 May 2009 03:18:54 +0000 Subject: [PATCH] Fix #921 detect if user has json-py installed and add dumps and loads attributes to it --- deluge/common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deluge/common.py b/deluge/common.py index 6f93dac65..35f4689cf 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -36,6 +36,12 @@ try: except ImportError: import simplejson as json +# Do a little hack here just in case the user has json-py installed since it +# has a different api +if not hasattr(json, "dumps"): + json.dumps = json.write + json.loads = json.read + import pkg_resources import xdg, xdg.BaseDirectory