1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Description: Handle API change in WebOb 1.1.1
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Debian: http://bugs.debian.org/629699
Bug-Ubuntu: https://bugs.launchpad.net/bugs/910766
Forwarded: no
Last-Update: 2012-04-20
Index: b/webhelpers/mimehelper.py
===================================================================
--- a/webhelpers/mimehelper.py
+++ b/webhelpers/mimehelper.py
@@ -110,8 +110,14 @@
if '.' in last_part:
has_extension = True
if 'HTTP_ACCEPT' in self.env:
- possible_from_accept_header = webob.acceptparse.MIMEAccept('ACCEPT',
- self.env['HTTP_ACCEPT'])
+ try:
+ # WebOb >= 1.1.1
+ possible_from_accept_header = webob.acceptparse.MIMEAccept(
+ self.env['HTTP_ACCEPT'])
+ except TypeError:
+ # WebOb < 1.1.1
+ possible_from_accept_header = webob.acceptparse.MIMEAccept('ACCEPT',
+ self.env['HTTP_ACCEPT'])
if has_extension == False:
if possible_from_accept_header is None:
return self._set_response_content_type(content_type)
|