summaryrefslogtreecommitdiff
path: root/webob/acceptparse.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-10-18 14:33:51 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-10-18 14:33:51 -0500
commit23a3c3b30781df3a548a5d3f786190d41ab51e95 (patch)
treebae392bef4ca774bb0dfd636aaa426a9e7b903aa /webob/acceptparse.py
parentd6de19bf6e524187459c0e45d060ef09b6146444 (diff)
downloadwebob-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.py2
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)):