def format_preserving_redirect(request, target, get_dict=None):
 my_get_dict = QueryDict('', mutable=True)
 if get_dict:
  my_get_dict.update(get_dict)
 if is_jframe_request(request):
  logging.info(('JFrame redirection' + target))
  my_get_dict['format'] = 'embed'
 elif request.ajax:
  my_get_dict['format'] = 'json'
 param = my_get_dict.urlencode()
 if param:
  if ('?' not in target):
   param = ('?' + param)
  else:
   param = ('&' + param)
 return HttpResponseRedirect((target + param))

def format_preserving_redirect ( request , target , get_dict = None ) : my_get_dict = QueryDict ( '' , mutable = True ) if get_dict : my_get_dict . update ( get_dict ) if is_jframe_request ( request ) : logging . info ( ( 'JFrame redirection' + target ) ) my_get_dict [ 'format' ] = 'embed' elif request . ajax : my_get_dict [ 'format' ] = 'json' param = my_get_dict . urlencode ( ) if param : if ( '?' not in target ) : param = ( '?' + param ) else : param = ( '&' + param ) return HttpResponseRedirect ( ( target + param ) )
if request represents an ajax or embeddable "format" .