qmsk/web/json.py
changeset 108 e77b7c324a32
child 110 7af0b8ce698f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk/web/json.py	Fri Jan 30 01:28:51 2015 +0200
@@ -0,0 +1,13 @@
+import json
+
+class JSONMixin:
+    MIMETYPE = 'application/json'
+
+    def render_json(self, **parms):
+        raise NotImplementedError()
+
+    def render_response(self, **params):
+        data = self.render_json(**params)
+
+        return json.dumps(data)
+