Is it time consuming to generate the spreadsheet? If not just display a 
link to the action that returns the spreadsheet. You need two actions. One 
displays the link and one compute the spreadsheet. You may need to pass 
data (in vars) between the two.

On Wednesday, 12 December 2012 13:51:21 UTC-6, 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