def alter_search(self, search):
    field_list_option = self.get_option('field_list')
    if (not field_list_option):
        return
    stmt = ('field_info_list = %s' % field_list_option.replace('\n', ' '))
    try:
        exec(stmt)
    except:
        return
    column = self.get_option('column')
    if (not column):
        print('\n')
        print('\n')
        print('*** ERROR: no column specified for CompoundValueFilterElementWdg')
        print('\n')
        print('\n')
        return
    field_map = {}
    for field_info in field_info_list:
        field = field_info.get('field')
        if field:
            value = self.values.get(field)
            to = field_info.get('to')
            if to:
                if to.endswith(')'):
                    stmt = ('value = value.%s' % to)
                else:
                    stmt = ('value = %s(value)' % to)
                try:
                    exec(stmt)
                except:
                    continue
            if value:
                field_map[field] = value
    compound_value = self.get_option('compound_value_expr')
    if (not compound_value):
        return
    for (f, v) in field_map.iteritems():
        compound_value = compound_value.replace(('{%s}' % f), v)
    op = self.get_option('op')
    if (not op):
        op = '='
    search.add_filter(column, compound_value, op)
def alter_search(self, search):
    field_list_option = self.get_option('field_list')
    if (not field_list_option):
        return
    stmt = ('field_info_list = %s' % field_list_option.replace('\n', ' '))
    try:
        exec(stmt)
    except:
        return
    column = self.get_option('column')
    if (not column):
        print('\n')
        print('\n')
        print('*** ERROR: no column specified for CompoundValueFilterElementWdg')
        print('\n')
        print('\n')
        return
    field_map = {}
    for field_info in field_info_list:
        field = field_info.get('field')
        if field:
            value = self.values.get(field)
            to = field_info.get('to')
            if to:
                if to.endswith(')'):
                    stmt = ('value = value.%s' % to)
                else:
                    stmt = ('value = %s(value)' % to)
                try:
                    exec(stmt)
                except:
                    continue
            if value:
                field_map[field] = value
    compound_value = self.get_option('compound_value_expr')
    if (not compound_value):
        return
    for (f, v) in field_map.iteritems():
        compound_value = compound_value.replace(('{%s}' % f), v)
    op = self.get_option('op')
    if (not op):
        op = '='
    search.add_filter(column, compound_value, op)