#NEWLINE# @ require_can_edit_data #NEWLINE# def importer_job_poll( request , domain , download_id , template = 'importer/partials/import_status.html' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# download_context = get_download_context ( download_id , check_state = True ) #NEWLINE# #UNINDENT# except TaskFailedError as e : #NEWLINE# #INDENT# error = e . errors #NEWLINE# if ( error == 'EXPIRED' ) : #NEWLINE# #INDENT# return _spreadsheet_expired ( request , domain ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( error == 'HAS_ERRORS' ) : #NEWLINE# #INDENT# messages . error ( request , _ ( 'The session containing the file you uploaded has expired - please upload a new one.' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# messages . error ( request , _ ( 'Sorry something went wrong with that import. Please try again. Report an issue if you continue to have problems.' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return HttpResponseRedirect ( ( base . ImportCases . get_url ( domain = domain ) + '?error=cache' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# context = RequestContext ( request ) #NEWLINE# context . update ( error ) #NEWLINE# context [ 'url' ] = base . ImportCases . get_url ( domain = domain ) #NEWLINE# return render_to_response ( template , context_instance = context )