web/views/json.py
changeset 10973 0939ad2edf63
parent 10700 a6d9d27f4253
child 10974 6557833657d6
--- a/web/views/json.py	Tue Dec 08 16:28:20 2015 +0100
+++ b/web/views/json.py	Tue Dec 15 08:55:58 2015 +0100
@@ -106,7 +106,8 @@
 
     The following additional metadata is added to each row :
 
-    - ``__cwetype__`` : entity type
+    - ``cw_etype`` : entity type
+    - ``cw_source`` : source url
     """
     __regid__ = 'ejsonexport'
     __select__ = EntityView.__select__ | empty_rset()
@@ -115,12 +116,8 @@
     def call(self):
         entities = []
         for entity in self.cw_rset.entities():
-            entity.complete() # fetch all attributes
-            # hack to add extra metadata
-            entity.cw_attr_cache.update({
-                    '__cwetype__': entity.cw_etype,
-                    })
-            entities.append(entity)
+            serializer = entity.cw_adapt_to('ISerializable')
+            entities.append(serializer.serialize())
         self.wdata(entities)