diff options
| author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-10-18 14:33:51 -0500 |
|---|---|---|
| committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-10-18 14:33:51 -0500 |
| commit | 23a3c3b30781df3a548a5d3f786190d41ab51e95 (patch) | |
| tree | bae392bef4ca774bb0dfd636aaa426a9e7b903aa /webob/acceptparse.py | |
| parent | d6de19bf6e524187459c0e45d060ef09b6146444 (diff) | |
| download | webob-23a3c3b30781df3a548a5d3f786190d41ab51e95.tar.gz | |
Fix NilAccept.best_match() so an empty "offers" + default_match picks default
Prior to this, NilAccept.best_match([], default_match="default") threw:
UnboundLocalError: local variable 'best_offer' referenced before assignment
Also added a relevant test.
Diffstat (limited to 'webob/acceptparse.py')
| -rw-r--r-- | webob/acceptparse.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/webob/acceptparse.py b/webob/acceptparse.py index 3f7f567..0b41cf2 100644 --- a/webob/acceptparse.py +++ b/webob/acceptparse.py @@ -224,7 +224,7 @@ class NilAccept(object): def best_match(self, offers, default_match=None): best_quality = -1 - best_match = default_match + best_offer = default_match for offer in offers: _check_offer(offer) if isinstance(offer, (list, tuple)): |
