Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 4757a0c

Browse files
author
Mangled Deutz
committed
JSONDecodeError -> ValueError
Docker-DCO-1.1-Signed-off-by: Mangled Deutz <[email protected]> (github: dmp42)
1 parent d2fc1c4 commit 4757a0c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

docker_registry/images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def put_image_json(image_id):
383383
try:
384384
# Note(dmp): unicode patch
385385
data = json.loads(flask.request.data.decode('utf8'))
386-
except json.JSONDecodeError:
386+
except ValueError:
387387
pass
388388
if not data or not isinstance(data, dict):
389389
return toolkit.api_error('Invalid JSON')

docker_registry/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_post_users():
5656
try:
5757
# Note(dmp): unicode patch
5858
json.loads(flask.request.data.decode('utf8'))
59-
except json.JSONDecodeError:
59+
except ValueError:
6060
return toolkit.api_error('Error Decoding JSON', 400)
6161
return toolkit.response('User Created', 201)
6262

@@ -106,7 +106,7 @@ def put_repository(namespace, repository, images=False):
106106
try:
107107
# Note(dmp): unicode patch
108108
data = json.loads(flask.request.data.decode('utf8'))
109-
except json.JSONDecodeError:
109+
except ValueError:
110110
return toolkit.api_error('Error Decoding JSON', 400)
111111
if not isinstance(data, list):
112112
return toolkit.api_error('Invalid data')

docker_registry/tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def set_properties(namespace, repo):
3333
try:
3434
# Note(dmp): unicode patch
3535
data = json.loads(flask.request.data.decode('utf8'))
36-
except json.JSONDecodeError:
36+
except ValueError:
3737
pass
3838
if not data or not isinstance(data, dict):
3939
return toolkit.api_error('Invalid data')
@@ -180,7 +180,7 @@ def put_tag(namespace, repository, tag):
180180
try:
181181
# Note(dmp): unicode patch
182182
data = json.loads(flask.request.data.decode('utf8'))
183-
except json.JSONDecodeError:
183+
except ValueError:
184184
pass
185185
if not data or not isinstance(data, basestring):
186186
return toolkit.api_error('Invalid data')

docker_registry/toolkit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def validate_parent_access(parent_id):
125125
# Note(dmp): unicode patch XXX not applied! Assuming requests does it
126126
logger.debug('validate_parent: Content: {0}'.format(resp.text))
127127
return json.loads(resp.text).get('access', False)
128-
except json.JSONDecodeError:
128+
except ValueError:
129129
logger.debug('validate_parent: Wrong response format')
130130
return False
131131

@@ -154,7 +154,7 @@ def validate_token(auth):
154154
images_list = [i['id'] for i in json.loads(resp.text)]
155155
store.put_content(store.images_list_path(*full_repos_name),
156156
json.dumps(images_list))
157-
except json.JSONDecodeError:
157+
except ValueError:
158158
logger.debug('validate_token: Wrong format for images_list')
159159
return False
160160
return True

0 commit comments

Comments
 (0)