Skip to content

Instantly share code, notes, and snippets.

@dfdeshom
Created May 14, 2010 14:27
Show Gist options
  • Save dfdeshom/401223 to your computer and use it in GitHub Desktop.
Save dfdeshom/401223 to your computer and use it in GitHub Desktop.
diff --git a/celerymonitor/handlers/api.py b/celerymonitor/handlers/api.py
index 7afa6d6..e86c614 100644
--- a/celerymonitor/handlers/api.py
+++ b/celerymonitor/handlers/api.py
@@ -12,6 +12,13 @@ def JSON(fun):
@wraps(fun)
def _write_json(self, *args, **kwargs):
content = fun(self, *args, **kwargs)
+ def _any(data):
+ if type(data) == type({}):
+ return dict([(k,str(v)) for (k,v) in data.iteritems()])
+ return str(data)
+ content = _any(content)
self.write(simplejson.dumps(content))
return _write_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment