Skip to content

Commit 78e3e74

Browse files
committed
Simplify q value validation
1 parent e27e987 commit 78e3e74

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mimeparse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ def parse_media_range(range):
7272
necessary.
7373
"""
7474
(type, subtype, params) = parse_mime_type(range)
75-
if 'q' not in params or not params['q'] or \
76-
float(params['q']) > 1 or float(params['q']) < 0:
75+
if not params.get('q') or not 0 <= float(params['q']) <= 1:
7776
params['q'] = '1'
7877

7978
return (type, subtype, params)

0 commit comments

Comments
 (0)