--- a/web/facet.py Tue Sep 27 14:57:41 2011 +0200
+++ b/web/facet.py Tue Sep 27 16:04:30 2011 +0200
@@ -64,7 +64,7 @@
from cubicweb import Unauthorized, typed_eid
from cubicweb.schema import display_name
from cubicweb.utils import make_uid
-from cubicweb.selectors import match_context_prop, partial_relation_possible
+from cubicweb.selectors import match_context_prop, partial_relation_possible, yes
from cubicweb.appobject import AppObject
from cubicweb.web import RequestError, htmlwidgets
@@ -1015,6 +1015,7 @@
(e.g when you want to filter on entities where are not directly linked to
the filtered entities).
"""
+ __select__ = yes() # we don't want RelationFacet's selector
# must be specified
path = None
filter_variable = None
@@ -1031,8 +1032,11 @@
def __init__(self, *args, **kwargs):
super(RQLPathFacet, self).__init__(*args, **kwargs)
+ assert self.filter_variable != self.label_variable, \
+ ('filter_variable and label_variable should be different. '
+ 'You may want to let label_variable undefined (ie None).')
assert self.path and isinstance(self.path, (list, tuple)), \
- 'path should be a list of 3-uples, not %s' % self.path
+ 'path should be a list of 3-uples, not %s' % self.path
for part in self.path:
if isinstance(part, basestring):
part = part.split()
@@ -1044,8 +1048,7 @@
','.join(str(p) for p in self.path))
def vocabulary(self):
- """return vocabulary for this facet, eg a list of 2-uple (label, value)
- """
+ """return vocabulary for this facet, eg a list of (label, value)"""
select = self.select
select.save_state()
if self.rql_sort: