[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Return html data + serve a file

Hello, iam using Python + Flask.
Iam trying to print some html and also serve a file to the user. My code is:

	pdata = pdata + '''<img src="/static/img/arrow.gif" align="left">'''

	# Prepare selected file for download....
	filename = request.form.get('filename')
	filepath = '/home/user/wsgi/static/files/'

	yield send_from_directory( filepath, filename, as_attachment=True )
	return pdata

The error i'm receiving is:

TypeError: 'generator' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a generator.

Can you help me understand why iam getting this error and how i should write it?