fixed issue 1268, better grid search options, thanks Paolo Angulo

This commit is contained in:
Massimo
2013-01-10 13:01:12 -06:00
parent 90dbf440c7
commit 8eadfe3d79
3 changed files with 30 additions and 10 deletions
+4 -2
View File
@@ -375,7 +375,7 @@ class Response(Storage):
wrapped = streamer(stream, chunk_size=chunk_size)
return wrapped
def download(self, request, db, chunk_size=DEFAULT_CHUNK_SIZE, attachment=True):
def download(self, request, db, chunk_size=DEFAULT_CHUNK_SIZE, attachment=True, download_filename=None):
"""
example of usage in controller::
@@ -403,9 +403,11 @@ class Response(Storage):
raise HTTP(404)
headers = self.headers
headers['Content-Type'] = contenttype(name)
if download_filename == None:
download_filename = filename
if attachment:
headers['Content-Disposition'] = \
'attachment; filename="%s"' % filename.replace('"','\"')
'attachment; filename="%s"' % download_filename.replace('"','\"')
return self.stream(stream, chunk_size=chunk_size, request=request)
def json(self, data, default=None):