Revize 2c645d25
Přidáno uživatelem Michal Seják před téměř 4 roky(ů)
src/utils/temporary_file.py | ||
---|---|---|
11 | 11 |
def __enter__(self): |
12 | 12 |
# if content was passed, write it to a new file specified by the given file name |
13 | 13 |
if len(self.content) > 0: |
14 |
with open(self.file_name, "w") as file: |
|
14 |
with open(self.file_name, "wb" if isinstance(self.content, bytes) else "w") as file:
|
|
15 | 15 |
file.write(self.content) |
16 | 16 |
return self.file_name |
17 | 17 |
|
Také k dispozici: Unified diff
Re #8577 - Minor adjustment to accept binary contents.