make fyzz/spa2rql a recommends only
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 28 Jul 2009 16:33:53 +0200
changeset 2529 736893a990c4
parent 2528 6ae5d8082b39
child 2530 3cd117ecc3a8
make fyzz/spa2rql a recommends only
debian/control
web/views/sparql.py
--- a/debian/control	Tue Jul 28 11:08:11 2009 +0200
+++ b/debian/control	Tue Jul 28 16:33:53 2009 +0200
@@ -62,7 +62,7 @@
 Architecture: all
 XB-Python-Version: ${python:Versions}
 Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), python-simplejson (>= 1.3), python-elementtree
-Recommends: python-docutils, python-vobject, fckeditor
+Recommends: python-docutils, python-vobject, fckeditor, python-fyzz
 Description: web interface library for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
--- 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__)