diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2016-04-28 10:33:18 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2016-05-02 10:19:27 +0300 |
commit | 78e3e74deff9dddc54e22d1fbe9071383ab39ddc (patch) | |
tree | a5ee0c7c05f9530c2d72c1a02fd6b9d7c18931ca | |
parent | e27e98702ec803ba2f12f6196fdadb8cb20ecf93 (diff) | |
download | python-mimeparse-78e3e74deff9dddc54e22d1fbe9071383ab39ddc.tar.gz |
Simplify q value validation
-rw-r--r-- | mimeparse.py | 3 |
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) |