def _wrap_generator_with_readonly(generator):
 def wrapper_generator(*args, **kwargs):
  generator_obj = generator(*args, **kwargs)
  readonly_connection.connection().set_django_connection()
  try:
   first_value = generator_obj.next()
  finally:
   readonly_connection.connection().unset_django_connection()
  (yield first_value)
  while True:
   (yield generator_obj.next())
 wrapper_generator.__name__ = generator.__name__
 return wrapper_generator

def _wrap_generator_with_readonly ( generator ) : def wrapper_generator ( * args , ** kwargs ) : generator_obj = generator ( * args , ** kwargs ) readonly_connection . connection ( ) . set_django_connection ( ) try : first_value = generator_obj . next ( ) finally : readonly_connection . connection ( ) . unset_django_connection ( ) ( yield first_value ) while True : ( yield generator_obj . next ( ) ) wrapper_generator . __name__ = generator . __name__ return wrapper_generator
we have to wrap generators specially .