summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2016-04-28 10:33:18 +0300
committerVille Skyttä <ville.skytta@iki.fi>2016-05-02 10:19:27 +0300
commit78e3e74deff9dddc54e22d1fbe9071383ab39ddc (patch)
treea5ee0c7c05f9530c2d72c1a02fd6b9d7c18931ca
parente27e98702ec803ba2f12f6196fdadb8cb20ecf93 (diff)
downloadpython-mimeparse-78e3e74deff9dddc54e22d1fbe9071383ab39ddc.tar.gz
Simplify q value validation
-rw-r--r--mimeparse.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/mimeparse.py b/mimeparse.py
index 2884b1d..4be4eb1 100644
--- a/mimeparse.py
+++ b/mimeparse.py
@@ -72,8 +72,7 @@ def parse_media_range(range):
necessary.
"""
(type, subtype, params) = parse_mime_type(range)
- if 'q' not in params or not params['q'] or \
- float(params['q']) > 1 or float(params['q']) < 0:
+ if not params.get('q') or not 0 <= float(params['q']) <= 1:
params['q'] = '1'
return (type, subtype, params)