if an "address" (response following a request) sends a file as an 
attachment, there's no way to "inject" any other behaviour (like a 
redirect) because the response will effectively end with the last byte of 
the attachment. 
I think the only possible way is open an iframe with the src pointing to 
the "download" stream.

On Wednesday, December 12, 2012 8:51:21 PM UTC+1, Jim S wrote:
>
> I'm looking for a way to return an Excel sheet to the user and then 
> redirect to a different page all in the same request.
>
> Here is what I'm doing now:
>
> from reports import movementDetail as rpt
> letters_file = StringIO.StringIO()
> returnVal = rpt.process(originationId, fromDate, toDate, letters_file,auth
> .user.id)
> if returnVal:
>     excelFile = letters_file.getvalue()
>     letters_file.close()
>     response.headers['Content-Type']='application/vnd.ms-excel'
>     return(excelFile)
> else:
>     response.flash = 'No movements for specific origin in date range.'
>     return dict(form=form)
>
> When I do the return(excelFile) I somehow would like to pass a URL that it 
> would redirect to when the excel sheet is returned.  Any ideas?  I'm 
> guessing there is something simple I'm missing.
>
> -Jim
>

-- 



Reply via email to