Fix minor cron.py issues #64

Merged
pfm merged 13 commits from fix-cron-script into master 2022-05-06 19:25:13 +02:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit f472f4ac22 - Show all commits

View File

@ -74,7 +74,7 @@ def public_keys( keyhome ):
# confirms a key has a given email address # confirms a key has a given email address
def confirm_key( content, email ): def confirm_key( content, email ):
tmpkeyhome = '' tmpkeyhome = ''
if type(content) == 'str': if isinstance(content, str):
content = bytes(content, sys.getdefaultencoding()) content = bytes(content, sys.getdefaultencoding())
while True: while True:
@ -104,7 +104,7 @@ def confirm_key( content, email ):
# adds a key and ensures it has the given email address # adds a key and ensures it has the given email address
def add_key( keyhome, content ): def add_key( keyhome, content ):
if type(content) == 'str': if isinstance(content, str):
content = bytes(content, sys.getdefaultencoding()) content = bytes(content, sys.getdefaultencoding())
p = subprocess.Popen( build_command(keyhome, '--import', '--batch'), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) p = subprocess.Popen( build_command(keyhome, '--import', '--batch'), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
p.communicate(input=content) p.communicate(input=content)