'Add a new filter by setting it on all subqueries.
If any of the setting operations raise an exception, the ones
that succeeded are undone and the exception is propagated
upward.
Args:
query_filter: a string of the form "property operand".
value: the value that the given property is compared against.'

def __setitem__(self, query_filter, value):

    saved_items = []
    for (index, query) in enumerate(self.__bound_queries):
        saved_items.append(query.get(query_filter, None))
        try:
            query[query_filter] = value
        except:
            for (q, old_value) in itertools.izip(self.__bound_queries[:index], saved_items):
                if (old_value is not None):
                    q[query_filter] = old_value
                else:
                    del q[query_filter]
            raise
