def rendered_data(self, thing): """ Called only when get_api_type is non-None (i.e., a JSON request has been made with partial rendering of the object to be returned) Canonical Thing data representation for JS, which is currently a dictionary of three elements (translated into a JS Object when sent out). The elements are: * id : Thing _fullname of thing. * content : rendered representation of the thing by calling render on it using the style of get_api_subtype(). """ res = dict(id=thing._fullname, content=thing.render(style=get_api_subtype())) return res
def rendered_data(self, thing): """ Called only when get_api_type is non-None (i.e., a JSON request has been made with partial rendering of the object to be returned) Canonical Thing data representation for JS, which is currently a dictionary of three elements (translated into a JS Object when sent out). The elements are: * id : Thing _fullname of thing. * content : rendered representation of the thing by calling render on it using the style of get_api_subtype(). """ res = dict(id = thing._fullname, content = thing.render(style=get_api_subtype())) return res
def data(self, thing): if get_api_subtype(): return self.rendered_data(thing) else: return self.raw_data(thing)