tags 629699 patch
user ubuntu-de...@lists.ubuntu.com
usertags 629699 ubuntu-patch precise
thanks

On Mon, Jan 02, 2012 at 10:27:13AM +0100, Matthias Klose wrote:
> the Fedora patch is not enough, it fails later with:
> 
> ======================================================================
> ERROR: test_mimetypes.test_root_path
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/nose/case.py", line 187, in runTest
>     self.test(*self.arg)
>   File "/home/packages/tmp/webhelpers-1.3/tests/test_mimetypes.py", line 36, 
> in
> test_root_path
>     eq_(m.mimetype('text/html'), 'text/html')
>   File "/home/packages/tmp/webhelpers-1.3/webhelpers/mimehelper.py", line 114,
> in mimetype
>     self.env['HTTP_ACCEPT'])
> TypeError: __init__() takes exactly 2 arguments (3 given)

This is due to an API change in WebOb 1.1.1 vs. 1.1 (!).  Here's a patch
(which I guess is in addition to disabling
test_distance_of_time_in_words; but that's trivial, and we have a few
years before it starts being a problem again in TZ=UTC ...).

I've test-built this with both python-webob 1.0.8-1 and 1.1.1-1.  The
first argument to the MIMEAccept constructor was previously used only
for adjusting its header parsing, and 'ACCEPT' invoked the default
behaviour there, so simply omitting it is safe with the new API.

  * Handle API change in WebOb 1.1.1.

diff -Nru webhelpers-1.3/debian/patches/series 
webhelpers-1.3/debian/patches/series
--- webhelpers-1.3/debian/patches/series        1970-01-01 01:00:00.000000000 
+0100
+++ webhelpers-1.3/debian/patches/series        2012-04-20 12:53:09.000000000 
+0100
@@ -0,0 +1 @@
+webob_1.1.1.patch
diff -Nru webhelpers-1.3/debian/patches/webob_1.1.1.patch 
webhelpers-1.3/debian/patches/webob_1.1.1.patch
--- webhelpers-1.3/debian/patches/webob_1.1.1.patch     1970-01-01 
01:00:00.000000000 +0100
+++ webhelpers-1.3/debian/patches/webob_1.1.1.patch     2012-04-20 
13:10:19.000000000 +0100
@@ -0,0 +1,28 @@
+Description: Handle API change in WebOb 1.1.1
+Author: Colin Watson <cjwat...@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)

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to