# HG changeset patch # User Laurent Peuch # Date 1576739632 -3600 # Node ID c13c0188f8a3226d70e3d77bc6d6b6d5f658f4a1 # Parent 71a842bdf81d8c104146a0ee800c6b21564ca77b autopep8 diff -r 71a842bdf81d -r c13c0188f8a3 cubicweb/web/views/sparql.py --- a/cubicweb/web/views/sparql.py Thu Dec 19 08:13:22 2019 +0100 +++ b/cubicweb/web/views/sparql.py Thu Dec 19 08:13:52 2019 +0100 @@ -35,6 +35,7 @@ # fyzz not available (only a recommends) Sparql2rqlTranslator = None + class SparqlForm(forms.FieldsForm): __regid__ = 'sparql' sparql = formfields.StringField(help=_('type here a sparql query')) @@ -50,6 +51,7 @@ class SparqlFormView(form.FormViewMixIn, StartupView): __regid__ = 'sparql' + def call(self): form = self._cw.vreg['forms'].select('sparql', self._cw) form.render(w=self.w) @@ -94,11 +96,13 @@ 'Interval': 'duration', 'Bytes': 'base64Binary', 'Password': 'string', - } +} + def xmlschema(yamstype): return 'http://www.w3.org/2001/XMLSchema#%s' % YAMS_XMLSCHEMA_MAPPING[yamstype] + class SparqlResultXmlView(AnyRsetView): """The spec can be found here: http://www.w3.org/TR/rdf-sparql-XMLres/ """ @@ -138,6 +142,7 @@ filename='sparql.xml', encoding=self._cw.encoding) + def registration_callback(vreg): if Sparql2rqlTranslator is not None: vreg.register_all(globals().values(), __name__)