I tried to use your code (with the obvious modifications) but I can't
really figure out how to use it...
Could you better explain your solution?
Thanks
Carlo
On Wednesday, April 23, 2014 4:00:26 PM UTC+2, Oli wrote:
>
>
> URL('Link for a new tab', _class="btn" , _title=T("in a new tab"),
> _href=URL("default","yourcontroller",args=[*row.id* <http://row.id/>]),
> *_target='_blank'*)
>
> Am Mittwoch, 23. April 2014 15:55:50 UTC+2 schrieb csavorgn:
>
>> Hi everyone,
>> I'm using a SQLFORM.factory to get the data I need to generate a PDF file
>> using ReportLab.
>> I'm using a submit button to check for the data entered and to open a
>> new page using redirect:
>>
>> redirect(URL("default","result", vars=dict(start=form.vars.date_start,
>> end=form.vars.date_end)))
>>
>> In the controller default.py I defined
>> def result():
>> start = request.vars['start']
>> end = request.vars['end']
>> filename = os.path.join(request.folder,'private',str(uuid4()))
>> create_pdf(filename, db, start, end)
>> response.headers['Content-Type']='application/pdf'
>> data = open(filename,"rb").read()
>> os.unlink(filename)
>> return data
>>
>> (The code I'm using is more complex than this.)
>>
>> Maybe it is not the cleanest way to do this, but when I click on the
>> button the temporary PDF opens on the same tab in the browser.
>>
>> In my app I would like to get a different behaviour: when I click on the
>> submit button the PDF should open on a new tab. The PDF should be temporary
>> as it is in my current code.
>> How can I achieve the behaviour I want?
>>
>> Thanks
>>
>> Carlo
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.