def migrating_cached_query(model, filter_fn=filter_identity):
 decorator = cached_query(model, filter_fn)
 def migrating_cached_query_decorator(fn):
  wrapped = decorator(fn)
  def migrating_cached_query_wrapper(*args):
   new_query = wrapped(*args)
   old_query = make_results(new_query.query, filter_fn)
   old_query.new_query = new_query
   return old_query
  return migrating_cached_query_wrapper
 return migrating_cached_query_decorator

def migrating_cached_query ( model , filter_fn = filter_identity ) : decorator = cached_query ( model , filter_fn ) def migrating_cached_query_decorator ( fn ) : wrapped = decorator ( fn ) def migrating_cached_query_wrapper ( * args ) : new_query = wrapped ( * args ) old_query = make_results ( new_query . query , filter_fn ) old_query . new_query = new_query return old_query return migrating_cached_query_wrapper return migrating_cached_query_decorator
returns a cachedresults object that has a new-style cached query attached as "new_query" .