Litt fiksing i tmpfil-skriving.
Koder teksten i utf8. La til en bindestrek mellom det ønskede filnavnet og det som genereres.
This commit is contained in:
parent
ae465733f6
commit
01a113891e
@ -14,6 +14,8 @@ import search
|
||||
import placement
|
||||
import tempfile
|
||||
|
||||
file_encoding = 'utf8'
|
||||
|
||||
def show_book_or_person(ids, commit_format=False, tmp_file=False):
|
||||
objects = map(get_book_or_person, ids)
|
||||
for i in range(len(ids)):
|
||||
@ -218,8 +220,8 @@ def run_editor(filename):
|
||||
exit("Error: %s: File does not exist!" % filename)
|
||||
|
||||
def write_tmpfile(pfix='', content=''):
|
||||
file = tempfile.NamedTemporaryFile(prefix=pfix, dir='/tmp', delete=False)
|
||||
file.write(content)
|
||||
file = tempfile.NamedTemporaryFile(prefix=pfix+'-', dir='/tmp', delete=False)
|
||||
file.write(content.encode(file_encoding))
|
||||
name = file.name
|
||||
file.close()
|
||||
return name
|
||||
|
Reference in New Issue
Block a user