web/views/json.py
branchstable
changeset 8629 3ae893f9ec84
parent 8601 1a6000ff2080
child 8651 353bbd17a8b6
equal deleted inserted replaced
8628:b236b91836c0 8629:3ae893f9ec84
    21 
    21 
    22 __docformat__ = "restructuredtext en"
    22 __docformat__ = "restructuredtext en"
    23 _ = unicode
    23 _ = unicode
    24 
    24 
    25 from cubicweb.utils import json_dumps
    25 from cubicweb.utils import json_dumps
       
    26 from cubicweb.predicates import any_rset
    26 from cubicweb.view import EntityView, AnyRsetView
    27 from cubicweb.view import EntityView, AnyRsetView
    27 from cubicweb.web.application import anonymized_request
    28 from cubicweb.web.application import anonymized_request
    28 from cubicweb.web.views import basecontrollers
    29 from cubicweb.web.views import basecontrollers
    29 
    30 
    30 class JsonpController(basecontrollers.ViewController):
    31 class JsonpController(basecontrollers.ViewController):
    88 
    89 
    89 
    90 
    90 class JsonRsetView(JsonMixIn, AnyRsetView):
    91 class JsonRsetView(JsonMixIn, AnyRsetView):
    91     """dumps raw result set in JSON format"""
    92     """dumps raw result set in JSON format"""
    92     __regid__ = 'jsonexport'
    93     __regid__ = 'jsonexport'
       
    94     __select__ = any_rset() # means rset might be empty or have any shape
    93     title = _('json-export-view')
    95     title = _('json-export-view')
    94 
    96 
    95     def call(self):
    97     def call(self):
    96         # XXX mimic w3c recommandations to serialize SPARQL results in json ?
    98         # XXX mimic w3c recommandations to serialize SPARQL results in json ?
    97         #     http://www.w3.org/TR/rdf-sparql-json-res/
    99         #     http://www.w3.org/TR/rdf-sparql-json-res/