def get_filter_state_from_data(self, name, data):
    '\n        Another nasty little bit. This one (if not overridden) takes some\n        data and encodes it, using the filter state names, to be a valid\n        filter_state which would return the original data if passed to get_data\n\n        TODO: Make sure this actually works for stuff other than\n              NumericComparisonFilter\n\n        TODO: Add good comments :P\n        '
    if (len(self.filter_state_names) > 1):
        if (not (hasattr(data, '__iter__') and (len(self.filter_state_names) == len(data)))):
            raise Exception()
        state = {}
        for i in range(0, len(data)):
            state.update({(self.filter_state_names[i] % name): data[i]})
        return state
    else:
        return {(self.filter_state_names[0] % name): data}
Another nasty little bit. This one (if not overridden) takes some
data and encodes it, using the filter state names, to be a valid
filter_state which would return the original data if passed to get_data

TODO: Make sure this actually works for stuff other than
      NumericComparisonFilter

TODO: Add good comments :P
def get_filter_state_from_data(self, name, data):
    '\n        Another nasty little bit. This one (if not overridden) takes some\n        data and encodes it, using the filter state names, to be a valid\n        filter_state which would return the original data if passed to get_data\n\n        TODO: Make sure this actually works for stuff other than\n              NumericComparisonFilter\n\n        TODO: Add good comments :P\n        '
    if (len(self.filter_state_names) > 1):
        if (not (hasattr(data, '__iter__') and (len(self.filter_state_names) == len(data)))):
            raise Exception()
        state = {}
        for i in range(0, len(data)):
            state.update({(self.filter_state_names[i] % name): data[i]})
        return state
    else:
        return {(self.filter_state_names[0] % name): data}