forked from orbit-oss/flask
fix minitwit/flaskr test errors, improve docs about file open mode
app.open_resource needs to get called with the correct mode param (python3 will read bytes [not str] if the wrong mode is used), add mode param docs. rv.data is bytes, fix the data type we compare it with to be also bytes
This commit is contained in:
parent
85ba8c96e9
commit
8bb972e5ae
8 changed files with 42 additions and 40 deletions
|
|
@ -630,6 +630,7 @@ class Flask(_PackageBoundObject):
|
|||
|
||||
:param resource: the name of the resource. To access resources within
|
||||
subfolders use forward slashes as separator.
|
||||
:param mode: resource file opening mode, default is 'rb'.
|
||||
"""
|
||||
return open(os.path.join(self.instance_path, resource), mode)
|
||||
|
||||
|
|
|
|||
|
|
@ -838,6 +838,7 @@ class _PackageBoundObject(object):
|
|||
|
||||
:param resource: the name of the resource. To access resources within
|
||||
subfolders use forward slashes as separator.
|
||||
:param mode: resource file opening mode, default is 'rb'.
|
||||
"""
|
||||
if mode not in ('r', 'rb'):
|
||||
raise ValueError('Resources can only be opened for reading')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue