--- a/web/facet.py Thu Apr 21 17:25:32 2011 +0200
+++ b/web/facet.py Wed Apr 27 09:55:17 2011 +0200
@@ -451,6 +451,11 @@
return False
+def encode(obj, encoding):
+ if isinstance(obj, unicode):
+ return obj.encode(encoding)
+ return unicode(obj).encode(encoding)
+
class RelationFacet(VocabularyFacet):
"""Base facet to filter some entities according to other entities to which
they are related. Create concret facet by inheriting from this class an then
@@ -605,7 +610,8 @@
insert_attr_select_relation(
rqlst, self.filtered_variable, self.rtype, self.role, self.target_attr,
select_target_entity=False)
- values = [str(x) for x, in self.rqlexec(rqlst.as_string())]
+ encoding = self._cw.encoding
+ values = [encode(x, encoding) for x, in self.rqlexec(rqlst.as_string())]
except:
self.exception('while computing values for %s', self)
return []
@@ -936,7 +942,7 @@
"""return the widget instance to use to display this facet"""
values = set(value for _, value in self.vocabulary() if value is not None)
# Rset with entities (the facet is selected) but without values
- if len(values) == 0:
+ if len(values) < 2:
return None
return self.wdgclass(self, min(values), max(values))
@@ -1125,8 +1131,8 @@
def _render(self):
facet = self.facet
- facet._cw.add_js('ui.slider.js')
- facet._cw.add_css('ui.all.css')
+ facet._cw.add_js('jquery.ui.js')
+ facet._cw.add_css('jquery.ui.css')
sliderid = make_uid('theslider')
facetid = xml_escape(self.facet.__regid__)
facet._cw.html_headers.add_onload(self.onload % {