Created
July 29, 2014 20:27
-
-
Save richstoner/f43e6beaa3e3834a79bf to your computer and use it in GitHub Desktop.
file_generator for l120 of rest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elif isinstance(val, cherrypy.lib.file_generator): | |
# if endpoint returned a file generator, return it directly | |
# | |
# Example | |
# | |
# > from cherrypy.lib import file_generator | |
# > cherrypy.response.headers['Content-Type'] = "image/png" | |
# > png_handle = open(file_path, 'rb') | |
# > return file_generator(png_handle) | |
# | |
# | |
return val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment