Redirect to the .pdf endpoing even if we keep the .svg endpoing
Getty Ritter
8 years ago
| 28 | 28 | raise Exception('No file uploaded!') |
| 29 | 29 | choices = choices_from_excel(openpyxl.load_workbook(f.stream)) |
| 30 | 30 | choice_str = base64.urlsafe_b64encode('\x1c'.join(choices).encode('utf-8')) |
| 31 |
return flask.redirect('/bingo. |
|
| 31 | return flask.redirect('/bingo.pdf?choices={0}'.format(choice_str.decode('utf-8'))) | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | @app.route('/bingo.svg') |
| 36 | 36 | def generate(): |
| 37 | 37 | choice_str = base64.urlsafe_b64decode(flask.request.args.get('choices')) |
| 38 | 38 | choices = choice_str.decode('utf-8').split('\x1c') |
| 39 | print(choices) | |
| 40 | 39 | return mk_svg(choices), 200, {'Content-Type': 'application/pdf'} |
| 41 | 40 | |
| 42 | 41 | |