web/views/sparql.py
changeset 2529 736893a990c4
parent 2444 4e61d9e4befb
child 2789 39712da6f397
child 3689 deb13e88e037
--- a/web/views/sparql.py	Tue Jul 28 11:08:11 2009 +0200
+++ b/web/views/sparql.py	Tue Jul 28 16:33:53 2009 +0200
@@ -16,8 +16,11 @@
 from cubicweb.view import StartupView, AnyRsetView
 from cubicweb.web import Redirect, form, formfields, formwidgets as fwdgs
 from cubicweb.web.views import forms, urlrewrite
-from cubicweb.spa2rql import Sparql2rqlTranslator
-
+try:
+    from cubicweb.spa2rql import Sparql2rqlTranslator
+except ImportError:
+    # fyzz not available (only a recommends)
+    Sparql2rqlTranslator = None
 
 class SparqlForm(forms.FieldsForm):
     id = 'sparql'
@@ -113,3 +116,7 @@
         self.req.set_content_type(self.content_type,
                                   filename='sparql.xml',
                                   encoding=self.req.encoding)
+
+def registration_callback(vreg):
+    if Sparql2rqlTranslator is not None:
+        vreg.register_all(globals().values(), __name__)