diff options
author | Stefan Wójcik <wojcikstefan@gmail.com> | 2016-10-16 18:53:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-16 18:53:21 -0400 |
commit | 99d9699e19c77b477ef475f312be4c99d8270620 (patch) | |
tree | ccb27ae0cd37dbb1692dc595aa6a01ce3b069c0c /mimeparse.py | |
parent | d87c40f7116c2f3ba0538d5eee465c2eec63c3f6 (diff) | |
download | python-mimeparse-99d9699e19c77b477ef475f312be4c99d8270620.tar.gz |
let acceptable types specify their quality (#26)
Diffstat (limited to 'mimeparse.py')
-rw-r--r-- | mimeparse.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mimeparse.py b/mimeparse.py index 7794341..ae942fa 100644 --- a/mimeparse.py +++ b/mimeparse.py @@ -110,6 +110,9 @@ def quality_and_fitness_parsed(mime_type, parsed_ranges): ]) fitness += param_matches + # finally, add the target's "q" param (between 0 and 1) + fitness += float(target_params.get('q', 1)) + if fitness > best_fitness: best_fitness = fitness best_fit_q = params['q'] |