web/views/json.py
branchstable
changeset 8657 5ab6ec83d5ba
parent 8651 353bbd17a8b6
child 8694 d901c36bcfce
equal deleted inserted replaced
8656:9bb93efa1952 8657:5ab6ec83d5ba
   109     """
   109     """
   110     __regid__ = 'ejsonexport'
   110     __regid__ = 'ejsonexport'
   111     title = _('json-entities-export-view')
   111     title = _('json-entities-export-view')
   112 
   112 
   113     def call(self):
   113     def call(self):
   114         if self.cw_rset is None:
   114         entities = []
   115             self.wdata([self.cw_extra_kwargs.get('entity')])
   115         for entity in self.cw_rset.entities():
   116         else:
   116             entity.complete() # fetch all attributes
   117             self.wdata(list(self.cw_rset.entities()))
   117             # hack to add extra metadata
       
   118             entity.cw_attr_cache.update({
       
   119                     '__cwetype__': entity.__regid__,
       
   120                     })
       
   121             entities.append(entity)
       
   122         self.wdata(entities)