author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 26 Jan 2010 10:34:29 +0100 | |
changeset 4359 | fabc680bb0bf |
parent 4320 | 4efd4c306746 |
child 4614 | 95ccd84c892b |
permissions | -rw-r--r-- |
0 | 1 |
"""the facets box and some basic facets |
2 |
||
3 |
:organization: Logilab |
|
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3717
diff
changeset
|
4 |
:copyright: 2008-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
8 |
__docformat__ = "restructuredtext en" |
|
9 |
||
10 |
from simplejson import dumps |
|
11 |
||
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2283
diff
changeset
|
12 |
from logilab.mtconverter import xml_escape |
0 | 13 |
|
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2650
diff
changeset
|
14 |
from cubicweb.appobject import objectify_selector |
4320
4efd4c306746
closes #345410: two_lines_rset, two_cols_rset, two_etypes_rset are badly named
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
15 |
from cubicweb.selectors import (non_final_entity, multi_lines_rset, |
1132 | 16 |
match_context_prop, yes, relation_possible) |
0 | 17 |
from cubicweb.web.box import BoxTemplate |
1132 | 18 |
from cubicweb.web.facet import (AbstractFacet, FacetStringWidget, RelationFacet, |
2337
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
19 |
prepare_facets_rqlst, filter_hiddens, _cleanup_rqlst, |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
20 |
_prepare_vocabulary_rqlst) |
0 | 21 |
|
742
99115e029dca
replaced most of __selectors__ assignments with __select__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
22 |
@objectify_selector |
2161
200481e7b156
prepare time where it won't be mandatory to give rset to select()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
23 |
def contextview_selector(cls, req, rset=None, row=None, col=None, view=None, |
0 | 24 |
**kwargs): |
25 |
if view and getattr(view, 'filter_box_context_info', lambda: None)(): |
|
26 |
return 1 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
27 |
return 0 |
0 | 28 |
|
29 |
||
30 |
class FilterBox(BoxTemplate): |
|
31 |
"""filter results of a query""" |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
32 |
__regid__ = 'filter_box' |
4320
4efd4c306746
closes #345410: two_lines_rset, two_cols_rset, two_etypes_rset are badly named
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
33 |
__select__ = (((non_final_entity() & multi_lines_rset()) |
758
0c0dfd33a76d
instantiate selectors wherever needed
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
742
diff
changeset
|
34 |
| contextview_selector() |
0c0dfd33a76d
instantiate selectors wherever needed
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
742
diff
changeset
|
35 |
) & match_context_prop()) |
0 | 36 |
context = 'left' |
37 |
title = _('boxes_filter_box') |
|
38 |
visible = True # functionality provided by the search box by default |
|
39 |
order = 1 |
|
205
8ea3294e7427
make round corners optional on facet boxes
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
204
diff
changeset
|
40 |
roundcorners = True |
2214
a6b42cf05407
[facets] slightly better attr names
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2213
diff
changeset
|
41 |
|
2215
b1977f5263ac
by popular demand, let us setle on needs_xxx
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2214
diff
changeset
|
42 |
needs_css = 'cubicweb.facets.css' |
3006
4d85386b06a5
rename cubicweb.formfilter.js into cubicweb.facets.js
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2657
diff
changeset
|
43 |
needs_js = ('cubicweb.ajax.js', 'cubicweb.facets.js') |
2214
a6b42cf05407
[facets] slightly better attr names
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2213
diff
changeset
|
44 |
|
2325
363b66a15668
[cleaning] minor cleaning over last two checkins
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2323
diff
changeset
|
45 |
bk_linkbox_template = u'<div class="facetTitle">%s</div>' |
2283 | 46 |
|
0 | 47 |
def facetargs(self): |
48 |
"""this method returns the list of extra arguments that should |
|
49 |
be used by the facet |
|
50 |
""" |
|
51 |
return {} |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
52 |
|
0 | 53 |
def _get_context(self, view): |
54 |
context = getattr(view, 'filter_box_context_info', lambda: None)() |
|
55 |
if context: |
|
56 |
rset, vid, divid, paginate = context |
|
57 |
else: |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
58 |
rset = self.cw_rset |
0 | 59 |
vid, divid = None, 'pageContent' |
4244
2c3de1953d00
rename need_navigation into paginable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
60 |
paginate = view and view.paginable |
0 | 61 |
return rset, vid, divid, paginate |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
62 |
|
0 | 63 |
def call(self, view=None): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
64 |
req = self._cw |
2215
b1977f5263ac
by popular demand, let us setle on needs_xxx
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2214
diff
changeset
|
65 |
req.add_js( self.needs_js ) |
b1977f5263ac
by popular demand, let us setle on needs_xxx
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2214
diff
changeset
|
66 |
req.add_css( self.needs_css) |
205
8ea3294e7427
make round corners optional on facet boxes
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
204
diff
changeset
|
67 |
if self.roundcorners: |
8ea3294e7427
make round corners optional on facet boxes
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
204
diff
changeset
|
68 |
req.html_headers.add_onload('jQuery(".facet").corner("tl br 10px");') |
1132 | 69 |
rset, vid, divid, paginate = self._get_context(view) |
0 | 70 |
if rset.rowcount < 2: # XXX done by selectors, though maybe necessary when rset has been hijacked |
71 |
return |
|
72 |
if vid is None: |
|
5
64072193bd48
simple and naive implementation of 'bookmark this search' while using facets
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
73 |
vid = req.form.get('vid') |
0 | 74 |
rqlst = rset.syntax_tree() |
75 |
rqlst.save_state() |
|
76 |
try: |
|
77 |
mainvar, baserql = prepare_facets_rqlst(rqlst, rset.args) |
|
78 |
widgets = [] |
|
79 |
for facet in self.get_facets(rset, mainvar): |
|
2818
326375561412
propagate some api changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2813
diff
changeset
|
80 |
if facet.cw_propval('visible'): |
0 | 81 |
wdg = facet.get_widget() |
82 |
if wdg is not None: |
|
83 |
widgets.append(wdg) |
|
84 |
if not widgets: |
|
85 |
return |
|
2325
363b66a15668
[cleaning] minor cleaning over last two checkins
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2323
diff
changeset
|
86 |
if self.bk_linkbox_template: |
363b66a15668
[cleaning] minor cleaning over last two checkins
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2323
diff
changeset
|
87 |
self.display_bookmark_link(rset) |
0 | 88 |
w = self.w |
89 |
w(u'<form method="post" id="%sForm" cubicweb:facetargs="%s" action="">' % ( |
|
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2283
diff
changeset
|
90 |
divid, xml_escape(dumps([divid, vid, paginate, self.facetargs()])))) |
0 | 91 |
w(u'<fieldset>') |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
92 |
hiddens = {'facets': ','.join(wdg.facet.__regid__ for wdg in widgets), |
0 | 93 |
'baserql': baserql} |
94 |
for param in ('subvid', 'vtitle'): |
|
5
64072193bd48
simple and naive implementation of 'bookmark this search' while using facets
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
95 |
if param in req.form: |
64072193bd48
simple and naive implementation of 'bookmark this search' while using facets
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
96 |
hiddens[param] = req.form[param] |
0 | 97 |
filter_hiddens(w, **hiddens) |
98 |
for wdg in widgets: |
|
99 |
wdg.render(w=self.w) |
|
100 |
w(u'</fieldset>\n</form>\n') |
|
101 |
finally: |
|
102 |
rqlst.recover() |
|
103 |
||
2325
363b66a15668
[cleaning] minor cleaning over last two checkins
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2323
diff
changeset
|
104 |
def display_bookmark_link(self, rset): |
4045
f4a52abb6f4f
cw 3.6 api update
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3720
diff
changeset
|
105 |
eschema = self._cw.vreg.schema.eschema('Bookmark') |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
106 |
if eschema.has_perm(self._cw, 'add'): |
2260
080167dad19e
split FilterBox call function
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2215
diff
changeset
|
107 |
bk_path = 'view?rql=%s' % rset.printable_rql() |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
108 |
bk_title = self._cw._('my custom search') |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
109 |
linkto = 'bookmarked_by:%s:subject' % self._cw.user.eid |
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
110 |
bk_add_url = self._cw.build_url('add/Bookmark', path=bk_path, title=bk_title, __linkto=linkto) |
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
111 |
bk_base_url = self._cw.build_url('add/Bookmark', title=bk_title, __linkto=linkto) |
2260
080167dad19e
split FilterBox call function
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2215
diff
changeset
|
112 |
bk_link = u'<a cubicweb:target="%s" id="facetBkLink" href="%s">%s</a>' % ( |
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2283
diff
changeset
|
113 |
xml_escape(bk_base_url), |
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2283
diff
changeset
|
114 |
xml_escape(bk_add_url), |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
115 |
self._cw._('bookmark this search')) |
2325
363b66a15668
[cleaning] minor cleaning over last two checkins
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2323
diff
changeset
|
116 |
self.w(self.bk_linkbox_template % bk_link) |
2260
080167dad19e
split FilterBox call function
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2215
diff
changeset
|
117 |
|
0 | 118 |
def get_facets(self, rset, mainvar): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
119 |
return self._cw.vreg['facets'].poss_visible_objects(self._cw, rset=rset, |
2813
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2657
diff
changeset
|
120 |
context='facetbox', |
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2657
diff
changeset
|
121 |
filtered_variable=mainvar) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
122 |
|
0 | 123 |
# facets ###################################################################### |
124 |
||
125 |
class CreatedByFacet(RelationFacet): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
126 |
__regid__ = 'created_by-facet' |
0 | 127 |
rtype = 'created_by' |
128 |
target_attr = 'login' |
|
129 |
||
130 |
class InGroupFacet(RelationFacet): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
131 |
__regid__ = 'in_group-facet' |
0 | 132 |
rtype = 'in_group' |
133 |
target_attr = 'name' |
|
134 |
||
135 |
class InStateFacet(RelationFacet): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
136 |
__regid__ = 'in_state-facet' |
0 | 137 |
rtype = 'in_state' |
138 |
target_attr = 'name' |
|
139 |
||
140 |
# inherit from RelationFacet to benefit from its possible_values implementation |
|
141 |
class ETypeFacet(RelationFacet): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
142 |
__regid__ = 'etype-facet' |
742
99115e029dca
replaced most of __selectors__ assignments with __select__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
143 |
__select__ = yes() |
0 | 144 |
order = 1 |
145 |
rtype = 'is' |
|
146 |
target_attr = 'name' |
|
147 |
||
148 |
@property |
|
149 |
def title(self): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
150 |
return self._cw._('entity type') |
0 | 151 |
|
152 |
def vocabulary(self): |
|
153 |
"""return vocabulary for this facet, eg a list of 2-uple (label, value) |
|
154 |
""" |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
155 |
etypes = self.cw_rset.column_types(0) |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
156 |
return sorted((self._cw._(etype), etype) for etype in etypes) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
157 |
|
0 | 158 |
def add_rql_restrictions(self): |
159 |
"""add restriction for this facet into the rql syntax tree""" |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
160 |
value = self._cw.form.get(self.__regid__) |
0 | 161 |
if not value: |
162 |
return |
|
163 |
self.rqlst.add_type_restriction(self.filtered_variable, value) |
|
164 |
||
2337
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
165 |
def possible_values(self): |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
166 |
"""return a list of possible values (as string since it's used to |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
167 |
compare to a form value in javascript) for this facet |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
168 |
""" |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
169 |
rqlst = self.rqlst |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
170 |
rqlst.save_state() |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
171 |
try: |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
172 |
_cleanup_rqlst(rqlst, self.filtered_variable) |
2340
65445ae67db0
optimize rql for ETypeFacet possible_values
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2339
diff
changeset
|
173 |
etype_var = _prepare_vocabulary_rqlst(rqlst, self.filtered_variable, self.rtype, self.role) |
65445ae67db0
optimize rql for ETypeFacet possible_values
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2339
diff
changeset
|
174 |
attrvar = rqlst.make_variable() |
65445ae67db0
optimize rql for ETypeFacet possible_values
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2339
diff
changeset
|
175 |
rqlst.add_selected(attrvar) |
65445ae67db0
optimize rql for ETypeFacet possible_values
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2339
diff
changeset
|
176 |
rqlst.add_relation(etype_var, 'name', attrvar) |
65445ae67db0
optimize rql for ETypeFacet possible_values
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2339
diff
changeset
|
177 |
return [etype for _, etype in self.rqlexec(rqlst.as_string())] |
2337
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
178 |
finally: |
6620e5abcd99
select right possible_values for ETypeFacet
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
2323
diff
changeset
|
179 |
rqlst.recover() |
0 | 180 |
|
181 |
class HasTextFacet(AbstractFacet): |
|
742
99115e029dca
replaced most of __selectors__ assignments with __select__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
182 |
__select__ = relation_possible('has_text', 'subject') & match_context_prop() |
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
183 |
__regid__ = 'has_text-facet' |
0 | 184 |
rtype = 'has_text' |
185 |
role = 'subject' |
|
186 |
order = 0 |
|
187 |
@property |
|
188 |
def title(self): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
189 |
return self._cw._('has_text') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1132
diff
changeset
|
190 |
|
0 | 191 |
def get_widget(self): |
192 |
"""return the widget instance to use to display this facet |
|
193 |
||
194 |
default implentation expects a .vocabulary method on the facet and |
|
195 |
return a combobox displaying this vocabulary |
|
196 |
""" |
|
197 |
return FacetStringWidget(self) |
|
198 |
||
199 |
def add_rql_restrictions(self): |
|
200 |
"""add restriction for this facet into the rql syntax tree""" |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
201 |
value = self._cw.form.get(self.__regid__) |
0 | 202 |
if not value: |
203 |
return |
|
204 |
self.rqlst.add_constant_restriction(self.filtered_variable, 'has_text', value, 'String') |