Merge pull request #819 from decentral1se/remove-strerrr-access-errors

Use str instead of strerror
This commit is contained in:
Alexandre Aubin 2019-10-06 11:47:39 +02:00 committed by GitHub
commit 34d721ccec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -199,7 +199,7 @@ def user_create(operation_logger, username, firstname, lastname, mail, password,
with open('/etc/ssowat/conf.json.persistent') as json_conf: with open('/etc/ssowat/conf.json.persistent') as json_conf:
ssowat_conf = json.loads(str(json_conf.read())) ssowat_conf = json.loads(str(json_conf.read()))
except ValueError as e: except ValueError as e:
raise YunohostError('ssowat_persistent_conf_read_error', error=e.strerror) raise YunohostError('ssowat_persistent_conf_read_error', error=str(e))
except IOError: except IOError:
ssowat_conf = {} ssowat_conf = {}
@ -209,7 +209,7 @@ def user_create(operation_logger, username, firstname, lastname, mail, password,
with open('/etc/ssowat/conf.json.persistent', 'w+') as f: with open('/etc/ssowat/conf.json.persistent', 'w+') as f:
json.dump(ssowat_conf, f, sort_keys=True, indent=4) json.dump(ssowat_conf, f, sort_keys=True, indent=4)
except IOError as e: except IOError as e:
raise YunohostError('ssowat_persistent_conf_write_error', error=e.strerror) raise YunohostError('ssowat_persistent_conf_write_error', error=str(e))
try: try:
ldap.add('uid=%s,ou=users' % username, attr_dict) ldap.add('uid=%s,ou=users' % username, attr_dict)