Renamed funtion file() to send_file() because file is a reserved

built-in symbol. Redefine `file` can caused unpredictable issues
This commit is contained in:
pcdinh 2016-10-25 14:39:07 +07:00
parent 0e479d53da
commit 4cf68a4e3d

View File

@ -153,7 +153,7 @@ def html(body, status=200, headers=None):
content_type="text/html; charset=utf-8") content_type="text/html; charset=utf-8")
async def file(location, mime_type=None, headers=None): async def send_file(location, mime_type=None, headers=None):
filename = path.split(location)[-1] filename = path.split(location)[-1]
async with open_async(location, mode='rb') as _file: async with open_async(location, mode='rb') as _file: