equal
deleted
inserted
replaced
13 from lxml import etree |
13 from lxml import etree |
14 from lxml.builder import E |
14 from lxml.builder import E |
15 |
15 |
16 from cubicweb.view import StartupView, AnyRsetView |
16 from cubicweb.view import StartupView, AnyRsetView |
17 from cubicweb.web import Redirect, form, formfields, formwidgets as fwdgs |
17 from cubicweb.web import Redirect, form, formfields, formwidgets as fwdgs |
18 from cubicweb.web.views import forms, urlrewrite |
18 from cubicweb.web.views import forms |
19 try: |
19 try: |
20 from cubicweb.spa2rql import Sparql2rqlTranslator, UnsupportedQuery |
20 from cubicweb.spa2rql import Sparql2rqlTranslator, UnsupportedQuery |
21 except ImportError: |
21 except ImportError: |
22 # fyzz not available (only a recommends) |
22 # fyzz not available (only a recommends) |
23 Sparql2rqlTranslator = None |
23 Sparql2rqlTranslator = None |
43 sparql = self._cw.form.get('sparql') |
43 sparql = self._cw.form.get('sparql') |
44 vid = self._cw.form.get('resultvid', 'table') |
44 vid = self._cw.form.get('resultvid', 'table') |
45 if sparql: |
45 if sparql: |
46 try: |
46 try: |
47 qinfo = Sparql2rqlTranslator(self._cw.vreg.schema).translate(sparql) |
47 qinfo = Sparql2rqlTranslator(self._cw.vreg.schema).translate(sparql) |
48 except rql.TypeResolverException, ex: |
48 except rql.TypeResolverException: |
49 self.w(self._cw._('can not resolve entity types:') + u' ' + unicode('ex')) |
49 self.w(self._cw._('can not resolve entity types:') + u' ' + unicode('ex')) |
50 except UnsupportedQuery: |
50 except UnsupportedQuery: |
51 self.w(self._cw._('we are not yet ready to handle this query')) |
51 self.w(self._cw._('we are not yet ready to handle this query')) |
52 except xy.UnsupportedVocabulary, ex: |
52 except xy.UnsupportedVocabulary, ex: |
53 self.w(self._cw._('unknown vocabulary:') + u' ' + unicode('ex')) |
53 self.w(self._cw._('unknown vocabulary:') + u' ' + unicode('ex')) |