--- a/web/views/basecontrollers.py Fri Nov 04 13:03:52 2011 +0100
+++ b/web/views/basecontrollers.py Fri Nov 04 13:03:56 2011 +0100
@@ -31,14 +31,10 @@
from cubicweb.uilib import exc_message
from cubicweb.selectors import authenticated_user, anonymous_user, match_form_params
from cubicweb.mail import format_mail
-from cubicweb.web import Redirect, RemoteCallFailed, DirectResponse
+from cubicweb.web import Redirect, RemoteCallFailed, DirectResponse, facet
from cubicweb.web.controller import Controller
from cubicweb.web.views import vid_from_rset, formrenderers
-try:
- from cubicweb.web import facet as facetbase
-except ImportError: # gae
- facetbase = None
def jsonize(func):
"""decorator to sets correct content_type and calls `json_dumps` on
@@ -489,25 +485,24 @@
return None
return cb(self._cw)
- if facetbase is not None:
- @jsonize
- def js_filter_build_rql(self, names, values):
- form = self._rebuild_posted_form(names, values)
- self._cw.form = form
- builder = facetbase.FilterRQLBuilder(self._cw)
- return builder.build_rql()
+ @jsonize
+ def js_filter_build_rql(self, names, values):
+ form = self._rebuild_posted_form(names, values)
+ self._cw.form = form
+ builder = facet.FilterRQLBuilder(self._cw)
+ return builder.build_rql()
- @jsonize
- def js_filter_select_content(self, facetids, rql, mainvar):
- # Union unsupported yet
- select = self._cw.vreg.parse(self._cw, rql).children[0]
- filtered_variable = facetbase.get_filtered_variable(select, mainvar)
- facetbase.prepare_select(select, filtered_variable)
- update_map = {}
- for facetid in facetids:
- facet = facetbase.get_facet(self._cw, facetid, select, filtered_variable)
- update_map[facetid] = facet.possible_values()
- return update_map
+ @jsonize
+ def js_filter_select_content(self, facetids, rql, mainvar):
+ # Union unsupported yet
+ select = self._cw.vreg.parse(self._cw, rql).children[0]
+ filtered_variable = facet.get_filtered_variable(select, mainvar)
+ facet.prepare_select(select, filtered_variable)
+ update_map = {}
+ for fid in facetids:
+ fobj = facet.get_facet(self._cw, fid, select, filtered_variable)
+ update_map[fid] = fobj.possible_values()
+ return update_map
def js_unregister_user_callback(self, cbname):
self._cw.unregister_callback(self._cw.pageid, cbname)