Allow mode='rt' on open_resource() helper
This commit is contained in:
parent
05a4e15ee4
commit
ad709be46e
2 changed files with 27 additions and 0 deletions
|
|
@ -1055,6 +1055,8 @@ class _PackageBoundObject(object):
|
|||
subfolders use forward slashes as separator.
|
||||
:param mode: resource file opening mode, default is 'rb'.
|
||||
"""
|
||||
if mode == 'rt':
|
||||
mode = 'r'
|
||||
if mode not in ("r", "rb"):
|
||||
raise ValueError("Resources can only be opened for reading")
|
||||
return open(os.path.join(self.root_path, resource), mode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue