ipapython.secrets: Port to Python 3

StringIO was renamed in Python 3. The import was was unused,
so remove it.

Files need to be opened in binary mode if bytes are written to them.
(For Python 2: on Linux, there's no practical difference between
text and binary mode)

Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
Petr Viktorin 2015-10-20 18:14:14 +02:00 committed by Tomas Babej
parent 6811b4be6a
commit acf519f5c5
2 changed files with 1 additions and 2 deletions

View File

@ -11,7 +11,6 @@ import ldap
import os
import shutil
import sys
import StringIO
import tempfile

View File

@ -31,7 +31,7 @@ class TestiSecStore(unittest.TestCase):
cls.cert2db = os.path.join(testdir, 'cert2db')
os.mkdir(cls.cert2db)
seedfile = os.path.join(testdir, 'seedfile')
with open(seedfile, 'w') as f:
with open(seedfile, 'wb') as f:
seed = os.urandom(1024)
f.write(seed)
subprocess.call(['certutil', '-d', cls.certdb, '-N', '-f', pwfile])