File: webob_1.1.1.patch

package info (click to toggle)
webhelpers 1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch, wheezy
  • size: 1,800 kB
  • ctags: 1,154
  • sloc: python: 8,309; sh: 245; makefile: 114
file content (28 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download
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)