Merge pull request #5815 from ryanpetrello/fix-cli-settings-py2

fix a py2/py3 compat bug in the settings CLI

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-02-03 17:24:33 +00:00 committed by GitHub
commit ad53f4f5f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import functools
import json
from six import with_metaclass
from six import with_metaclass, PY3
from .stdout import monitor, monitor_workflow
from .utils import CustomRegistryMeta, color_enabled
@ -547,8 +547,11 @@ class SettingsModify(CustomAction):
return resp.from_json({'key': key, 'value': resp[key]})
def is_json(self, data):
err = ValueError
if PY3:
err = json.decoder.JSONDecodeError
try:
json.loads(data)
except json.decoder.JSONDecodeError:
except err:
return False
return True