osc-staging,issue-diff: open temporary file in write without binary mode.

Otherwise, all write calls complain about passing a string instead of
binary data. Given the yaml dump and subsequent comments are all strings
it makes more sense to change file mode.
This commit is contained in:
Jimmy Berry 2019-10-08 14:47:18 -05:00
parent 40a88ace51
commit 5b91d6bc84
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ def prompt_continue(change_count):
return prompt_continue(change_count)
def prompt_interactive(changes, project, package):
with tempfile.NamedTemporaryFile(suffix='.yml') as temp:
with tempfile.NamedTemporaryFile(mode='w', suffix='.yml') as temp:
temp.write(yaml.safe_dump(changes, default_flow_style=False, default_style="'") + '\n')
temp.write('# {}/{}\n'.format(project, package))
temp.write('# comment or remove lines to whitelist issues')

View File

@ -593,7 +593,7 @@ def do_staging(self, subcmd, opts, *args):
return
if opts.interactive:
with tempfile.NamedTemporaryFile(suffix='.yml') as temp:
with tempfile.NamedTemporaryFile(mode='w', suffix='.yml') as temp:
temp.write(yaml.safe_dump(splitter.proposal, default_flow_style=False) + '\n\n')
if len(splitter.requests):