Author: damoxc

Revision: 5637

Log:
        add dump and load methods to the json module if it isn't simplejson

Diff:
Modified: trunk/deluge/common.py
===================================================================
--- trunk/deluge/common.py      2009-08-07 07:33:35 UTC (rev 5636)
+++ trunk/deluge/common.py      2009-08-10 09:46:57 UTC (rev 5637)
@@ -53,6 +53,15 @@
     json.dumps = json.write
     json.loads = json.read
 
+    def dump(obj, fp, **kw):
+        fp.write(json.dumps(obj))
+
+    def load(fp, **kw):
+        return json.loads(fp.read())
+
+    json.dump = dump
+    json.load = load
+
 import pkg_resources
 import xdg, xdg.BaseDirectory
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to