[Python-modules-commits] r29164 - in packages/python-django-piston/trunk/debian (5 files)

asb at users.alioth.debian.org asb at users.alioth.debian.org
Sat May 31 18:21:43 UTC 2014


    Date: Saturday, May 31, 2014 @ 18:21:42
  Author: asb
Revision: 29164

* Cherry-pick patches from Ubuntu and upstream for Django
  1.5 and 1.6 compatability:
 - 04-json-compat-django1.5.patch: Use json instead of simplejson for
   Django 1.5. (LP: #1184219)
 - 05-compat-django1.5-httpresponsewrapper.patch: Compatibility with
   Django 1.5 for HttpResponseWrapper. (LP: #1185012)
 - 06-django1.6-wsgirequest-compat.patch: Compatibility
   with Django 1.6 for WSGIRequest. (LP: #1256957)

Added:
  packages/python-django-piston/trunk/debian/patches/04-json-compat-django1.5.patch
  packages/python-django-piston/trunk/debian/patches/05-compat-django1.5-httpresponsewrapper.patch
  packages/python-django-piston/trunk/debian/patches/06-django1.6-wsgirequest-compat.patch
Modified:
  packages/python-django-piston/trunk/debian/changelog
  packages/python-django-piston/trunk/debian/patches/series

Modified: packages/python-django-piston/trunk/debian/changelog
===================================================================
--- packages/python-django-piston/trunk/debian/changelog	2014-05-31 18:13:46 UTC (rev 29163)
+++ packages/python-django-piston/trunk/debian/changelog	2014-05-31 18:21:42 UTC (rev 29164)
@@ -15,6 +15,16 @@
   * Convert copyright to machine-readable format 1.0
   * Add repack script, remove lintian-overrides
 
+  [ Andrew Starr-Bochicchio ]
+  * Cherry-pick patches from Ubuntu and upstream for Django
+    1.5 and 1.6 compatability:
+   - 04-json-compat-django1.5.patch: Use json instead of simplejson for
+     Django 1.5. (LP: #1184219)
+   - 05-compat-django1.5-httpresponsewrapper.patch: Compatibility with
+     Django 1.5 for HttpResponseWrapper. (LP: #1185012)
+   - 06-django1.6-wsgirequest-compat.patch: Compatibility
+     with Django 1.6 for WSGIRequest. (LP: #1256957)
+
  -- Christophe Siraut <d at tobald.eu.org>  Fri, 09 May 2014 14:26:08 +0200
 
 python-django-piston (0.2.3-1) unstable; urgency=low

Added: packages/python-django-piston/trunk/debian/patches/04-json-compat-django1.5.patch
===================================================================
--- packages/python-django-piston/trunk/debian/patches/04-json-compat-django1.5.patch	                        (rev 0)
+++ packages/python-django-piston/trunk/debian/patches/04-json-compat-django1.5.patch	2014-05-31 18:21:42 UTC (rev 29164)
@@ -0,0 +1,52 @@
+From: Luke Plant
+Subject: Compatibility fix for JSON emitter with Django 1.5
+ Fixes compatibility with Django 1.5 to use json instead of
+ simplejson due to deprecation.
+Origin: https://bitbucket.org/jespern/django-piston/pull-request/25/compatibility-fix-for-json-emitter-with
+Bug-Ubuntu: https://launchpad.net/bugs/1184219
+
+--- python-django-piston-0.2.3.orig/piston/emitters.py	2013-05-28 11:49:03.230954662 -0400
++++ python-django-piston-0.2.3/piston/emitters.py	2013-05-28 11:50:19.151073326 -0400
+@@ -22,7 +22,6 @@
+ 
+ from django.db.models.query import QuerySet
+ from django.db.models import Model, permalink
+-from django.utils import simplejson
+ from django.utils.xmlutils import SimplerXMLGenerator
+ from django.utils.encoding import smart_unicode
+ from django.core.urlresolvers import reverse, NoReverseMatch
+@@ -30,6 +29,16 @@
+ from django.http import HttpResponse
+ from django.core import serializers
+ 
++import django
++if django.VERSION >= (1, 5):
++    # In 1.5 and later, DateTimeAwareJSONEncoder inherits from json.JSONEncoder,
++    # while in 1.4 and earlier it inherits from simplejson.JSONEncoder.  The two
++    # are not compatible due to keyword argument namedtuple_as_object, and we
++    # have to ensure that the 'dumps' function we use is the right one.
++    import json
++else:
++    from django.utils import simplejson as json
++
+ from utils import HttpStatusCode, Mimer
+ from validate_jsonp import is_valid_jsonp_callback_value
+ 
+@@ -388,7 +397,7 @@
+     """
+     def render(self, request):
+         cb = request.GET.get('callback', None)
+-        seria = simplejson.dumps(self.construct(), cls=DateTimeAwareJSONEncoder, ensure_ascii=False, indent=4)
++        seria = json.dumps(self.construct(), cls=DateTimeAwareJSONEncoder, ensure_ascii=False, indent=4)
+ 
+         # Callback
+         if cb and is_valid_jsonp_callback_value(cb):
+@@ -397,7 +406,7 @@
+         return seria
+ 
+ Emitter.register('json', JSONEmitter, 'application/json; charset=utf-8')
+-Mimer.register(simplejson.loads, ('application/json',))
++Mimer.register(json.loads, ('application/json',))
+ 
+ class YAMLEmitter(Emitter):
+     """

Added: packages/python-django-piston/trunk/debian/patches/05-compat-django1.5-httpresponsewrapper.patch
===================================================================
--- packages/python-django-piston/trunk/debian/patches/05-compat-django1.5-httpresponsewrapper.patch	                        (rev 0)
+++ packages/python-django-piston/trunk/debian/patches/05-compat-django1.5-httpresponsewrapper.patch	2014-05-31 18:21:42 UTC (rev 29164)
@@ -0,0 +1,26 @@
+From: Andrey Kuchev
+Subject: Added compatibility with Django v1.5 for HttpResponseWrapper class
+ Add compatibility for django 1.5 due to HttpResponse._get_content
+ not existing in Django 1.5
+Origin: https://bitbucket.org/jespern/django-piston/pull-request/34/added-compatibility-with-django-v15-for
+Bug-Ubuntu: https://launchpad.net/bugs/1185012
+
+--- python-django-piston-0.2.3.orig/piston/utils.py	2013-05-28 11:45:31.666460424 -0400
++++ python-django-piston-0.2.3/piston/utils.py	2013-05-28 11:48:26.590875780 -0400
+@@ -77,7 +77,15 @@
+                 else:
+                     self._is_string = is_string
+ 
+-            content = property(HttpResponse._get_content, _set_content)            
++            if django.VERSION >= (1, 5):
++                # HttpResponse._get_content does not exists in Django 1.5
++
++                @HttpResponse.content.setter
++                def content(self, content):
++                    self._set_content(content)
++
++            else:
++                content = property(HttpResponse._get_content, _set_content)
+ 
+         return HttpResponseWrapper(r, content_type='text/plain', status=c)
+     

Added: packages/python-django-piston/trunk/debian/patches/06-django1.6-wsgirequest-compat.patch
===================================================================
--- packages/python-django-piston/trunk/debian/patches/06-django1.6-wsgirequest-compat.patch	                        (rev 0)
+++ packages/python-django-piston/trunk/debian/patches/06-django1.6-wsgirequest-compat.patch	2014-05-31 18:21:42 UTC (rev 29164)
@@ -0,0 +1,18 @@
+From: Raphael Badin <raphael.badin at canonical.com>
+Subject: Compatibility fix for WSGIRequest with Django 1.6
+ Fixes compatibility with Django 1.6 to return the correct
+ data on a WSGIRequest.
+Origin: https://bitbucket.org/jespern/django-piston/issue/235/attributeerror-wsgirequest-object-has-no
+Bug-Ubuntu: https://launchpad.net/bugs/1256957
+
+--- python-django-piston-0.2.3.orig/piston/utils.py	2013-12-02 13:31:56.000000000 -0500
++++ python-django-piston-0.2.3/piston/utils.py	2013-12-02 13:35:30.358433201 -0500
+@@ -269,7 +269,7 @@
+             
+             if loadee:
+                 try:
+-                    self.request.data = loadee(self.request.raw_post_data)
++                    self.request.data = loadee(self.request.body)
+                         
+                     # Reset both POST and PUT from request, as its
+                     # misleading having their presence around.

Modified: packages/python-django-piston/trunk/debian/patches/series
===================================================================
--- packages/python-django-piston/trunk/debian/patches/series	2014-05-31 18:13:46 UTC (rev 29163)
+++ packages/python-django-piston/trunk/debian/patches/series	2014-05-31 18:21:42 UTC (rev 29164)
@@ -1,3 +1,6 @@
 01-fix-oauth-import.diff
 02-correct-httpresponse.patch
 03-django1.4-support.patch
+04-json-compat-django1.5.patch
+05-compat-django1.5-httpresponsewrapper.patch
+06-django1.6-wsgirequest-compat.patch




More information about the Python-modules-commits mailing list