web/views/json.py
branchstable
changeset 8651 353bbd17a8b6
parent 8629 3ae893f9ec84
child 8657 5ab6ec83d5ba
--- a/web/views/json.py	Thu Jan 17 14:40:57 2013 +0100
+++ b/web/views/json.py	Thu Jan 17 14:39:51 2013 +0100
@@ -111,12 +111,7 @@
     title = _('json-entities-export-view')
 
     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.__regid__,
-                    })
-            entities.append(entity)
-        self.wdata(entities)
+        if self.cw_rset is None:
+            self.wdata([self.cw_extra_kwargs.get('entity')])
+        else:
+            self.wdata(list(self.cw_rset.entities()))