Take expression out of Facet and put it in TextFacet. Add case_sensitive to TextFilterFacet

This commit is contained in:
Paul Makepeace 2011-04-26 19:09:52 -04:00
parent 5f24f5bd69
commit fe68217fba
1 changed files with 8 additions and 5 deletions

View File

@ -22,11 +22,10 @@ def from_camel(attr):
class Facet(object): class Facet(object):
def __init__(self, column, type, expression='value', **options): def __init__(self, column, type, **options):
self.type = type self.type = type
self.name = column self.name = column
self.column_name = column self.column_name = column
self.expression = expression
for k, v in options.items(): for k, v in options.items():
setattr(self, k, v) setattr(self, k, v)
@ -37,12 +36,15 @@ class Facet(object):
class TextFilterFacet(Facet): class TextFilterFacet(Facet):
def __init__(self, column, query, **options): def __init__(self, column, query, **options):
super(TextFilterFacet, self).__init__(column, query=query, type='text', super(TextFilterFacet, self).__init__(
column, query=query, case_sensitive=False, type='text',
mode='text', **options) mode='text', **options)
class TextFacet(Facet): class TextFacet(Facet):
def __init__(self, column, selection=None, omit_blank=False, omit_error=False, select_blank=False, select_error=False, invert=False, **options): def __init__(self, column, selection=None, expression='value',
omit_blank=False, omit_error=False, select_blank=False,
select_error=False, invert=False, **options):
super(TextFacet, self).__init__( super(TextFacet, self).__init__(
column, column,
type='list', type='list',
@ -52,6 +54,7 @@ class TextFacet(Facet):
select_error=select_error, select_error=select_error,
invert=invert, invert=invert,
**options) **options)
self.expression = expression
self.selection = [] self.selection = []
if selection is None: if selection is None:
selection = [] selection = []