Your message dated Sat, 31 May 2014 19:04:02 +0000
with message-id <e1wqozw-0004c8...@franck.debian.org>
and subject line Bug#686171: fixed in python-django-piston 0.2.3-2
has caused the Debian Bug report #686171,
regarding python-django-piston: Django 1.4 compatibility
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
686171: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686171
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python-django-piston
Version: 0.2.3-1
Severity: serious
Tags: upstream patch
Ubuntu has cherry-picked two upstream Django 1.4 compatibility patches
for python-django-piston, but they were never forwarded to Debian:
https://bitbucket.org/jespern/django-piston/changeset/7c90898072ce
https://bitbucket.org/jespern/django-piston/changeset/3a0d021dd042
Upstream hasn't released a version including these patches, yet, so I
propose we cherry-pick them too.
SR
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (900, 'testing'), (800, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
From: Andi Albrecht
Subject: Use _base_content_is_iter or _is_string
Correctly use _base_content_is_iter or _is_string on HttpResponse depending on
Django version.
Origin: upstream, https://bitbucket.org/jespern/django-piston/changeset/3a0d021dd042
--- python-django-piston-0.2.3.orig/piston/resource.py 2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/piston/resource.py 2012-06-27 12:43:41.424489361 -0400
@@ -1,5 +1,6 @@
import sys, inspect
+import django
from django.http import (HttpResponse, Http404, HttpResponseNotAllowed,
HttpResponseForbidden, HttpResponseServerError)
from django.views.debug import ExceptionReporter
@@ -181,13 +182,15 @@
# If we're looking at a response object which contains non-string
# content, then assume we should use the emitter to format that
# content
- if isinstance(result, HttpResponse) and not result._is_string:
+ if self._use_emitter(result):
status_code = result.status_code
- # Note: We can't use result.content here because that method attempts
- # to convert the content into a string which we don't want.
- # when _is_string is False _container is the raw data
+ # Note: We can't use result.content here because that
+ # method attempts to convert the content into a string
+ # which we don't want. when
+ # _is_string/_base_content_is_iter is False _container is
+ # the raw data
result = result._container
-
+
srl = emitter(result, typemapper, handler, fields, anonymous)
try:
@@ -212,6 +215,16 @@
return e.response
@staticmethod
+ def _use_emitter(result):
+ """True iff result is a HttpResponse and contains non-string content."""
+ if not isinstance(result, HttpResponse):
+ return False
+ elif django.VERSION >= (1, 4):
+ return not result._base_content_is_iter
+ else:
+ return result._is_string
+
+ @staticmethod
def cleanup_request(request):
"""
Removes `oauth_` keys from various dicts on the
--- python-django-piston-0.2.3.orig/piston/utils.py 2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/piston/utils.py 2012-06-27 12:43:41.424489361 -0400
@@ -1,4 +1,6 @@
import time
+
+import django
from django.http import HttpResponseNotAllowed, HttpResponseForbidden, HttpResponse, HttpResponseBadRequest
from django.core.urlresolvers import reverse
from django.core.cache import cache
@@ -50,24 +52,30 @@
class HttpResponseWrapper(HttpResponse):
"""
- Wrap HttpResponse and make sure that the internal _is_string
- flag is updated when the _set_content method (via the content
- property) is called
+ Wrap HttpResponse and make sure that the internal
+ _is_string/_base_content_is_iter flag is updated when the
+ _set_content method (via the content property) is called
"""
def _set_content(self, content):
"""
- Set the _container and _is_string properties based on the
- type of the value parameter. This logic is in the construtor
- for HttpResponse, but doesn't get repeated when setting
- HttpResponse.content although this bug report (feature request)
- suggests that it should: http://code.djangoproject.com/ticket/9403
+ Set the _container and _is_string /
+ _base_content_is_iter properties based on the type of
+ the value parameter. This logic is in the construtor
+ for HttpResponse, but doesn't get repeated when
+ setting HttpResponse.content although this bug report
+ (feature request) suggests that it should:
+ http://code.djangoproject.com/ticket/9403
"""
+ is_string = False
if not isinstance(content, basestring) and hasattr(content, '__iter__'):
self._container = content
- self._is_string = False
else:
self._container = [content]
- self._is_string = True
+ is_string = True
+ if django.VERSION >= (1, 4):
+ self._base_content_is_iter = not is_string
+ else:
+ self._is_string = is_string
content = property(HttpResponse._get_content, _set_content)
From: Andi Albrecht
Subject: Piston now supports Django 1.4
Support for Django 1.4
Origin: upstream, https://bitbucket.org/jespern/django-piston/changeset/7c90898072ce
Bug: https://bitbucket.org/jespern/django-piston/issue/214/django-14-compatibility
--- python-django-piston-0.2.3.orig/piston/resource.py 2012-06-27 12:43:54.384489691 -0400
+++ python-django-piston-0.2.3/piston/resource.py 2012-06-27 12:45:00.316491380 -0400
@@ -73,7 +73,7 @@
`Resource` subclass.
"""
resp = rc.BAD_REQUEST
- resp.write(' '+str(e.form.errors))
+ resp.write(u' '+unicode(e.form.errors))
return resp
@property
@@ -220,9 +220,9 @@
if not isinstance(result, HttpResponse):
return False
elif django.VERSION >= (1, 4):
- return not result._base_content_is_iter
+ return result._base_content_is_iter
else:
- return result._is_string
+ return not result._is_string
@staticmethod
def cleanup_request(request):
--- python-django-piston-0.2.3.orig/piston/tests.py 2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/piston/tests.py 2012-06-27 12:45:00.320491380 -0400
@@ -1,4 +1,5 @@
# Django imports
+import django
from django.core import mail
from django.contrib.auth.models import User
from django.conf import settings
@@ -100,7 +101,8 @@
response = resource(request, emitter_format='json')
self.assertEquals(201, response.status_code)
- self.assertTrue(response._is_string, "Expected response content to be a string")
+ is_string = (not response._base_content_is_iter) if django.VERSION >= (1,4) else response._is_string
+ self.assert_(is_string, "Expected response content to be a string")
# compare the original data dict with the json response
# converted to a dict
--- python-django-piston-0.2.3.orig/tests/test_project/settings.py 2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/tests/test_project/settings.py 2012-06-27 12:45:00.320491380 -0400
@@ -1,5 +1,12 @@
import os
DEBUG = True
+DATABASES = {
+ 'default':
+ {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': '/tmp/piston.db'
+ }
+}
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/piston.db'
INSTALLED_APPS = (
--- End Message ---
--- Begin Message ---
Source: python-django-piston
Source-Version: 0.2.3-2
We believe that the bug you reported is fixed in the latest version of
python-django-piston, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 686...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Andrew Starr-Bochicchio <a...@debian.org> (supplier of updated
python-django-piston package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sat, 31 May 2014 14:43:42 -0400
Source: python-django-piston
Binary: python-django-piston
Architecture: source all
Version: 0.2.3-2
Distribution: unstable
Urgency: low
Maintainer: Debian Python Modules Team
<python-modules-t...@lists.alioth.debian.org>
Changed-By: Andrew Starr-Bochicchio <a...@debian.org>
Description:
python-django-piston - Django mini-framework creating RESTful APIs
Closes: 686171
Changes:
python-django-piston (0.2.3-2) unstable; urgency=low
.
* Team upload.
.
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.
* Remove DM-Upload-Allowed; it's no longer used by the archive
software.
.
[ Christophe Siraut ]
* Enable django 1.4 compatibility. (Closes: #686171)
- 02-correct-httpresponse.patch: Correctly use '_base_content_is_iter'
or '_is_string' depending on the Django version
- 03-django1.4-support.patch: Add support for Django 1.4.
* Use dh_python2
* Bump standards version to 3.9.5 without further change
* 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)
Checksums-Sha1:
b39b820e2309f6b5cc362d56c838a998a8bdf70d 2149 python-django-piston_0.2.3-2.dsc
55b643214e7cf5ed5ad13125ecbc7bcf25c86eb5 7648
python-django-piston_0.2.3-2.debian.tar.xz
67c6abbe6db1c7dfe4a504d433b371f50e03d18e 29682
python-django-piston_0.2.3-2_all.deb
Checksums-Sha256:
f91e60c0b60b0229187fcfc4f192f21595e695f1b6f3de110e19168300f5b613 2149
python-django-piston_0.2.3-2.dsc
9cbeca26068fd8a1db52da21d832fb188e7a7c998e9d0e3d3ce027e566c9f965 7648
python-django-piston_0.2.3-2.debian.tar.xz
a880d0611781626264c3203cdc1428736224665b61d919111114aa31cd80b64f 29682
python-django-piston_0.2.3-2_all.deb
Files:
84ed9a78fbbc465e2fa3b75bdb1883fb 29682 python optional
python-django-piston_0.2.3-2_all.deb
f4850b94b7bc25aa27008fc99bd109df 2149 python optional
python-django-piston_0.2.3-2.dsc
f4d0a0ecc2550874d639e74a4e96b13f 7648 python optional
python-django-piston_0.2.3-2.debian.tar.xz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJTiiQTAAoJEDtW4rvVP9yxNE0QAJOyCadNa7HGKNOWgIuRAMW7
WJZPGGGmoD2R+pcO+8VzSJ+PIV1F5I3swTLHU+WHBN30QnVMteTbUduH7UPWOgIP
O/BKHEV6gd0ljNWVxaES/RkJMKQeApmkFP1gjuJQotKJXa1coeSDl7rELE0Iwu7H
YHKz92Cx9H3TfwarsHgdHHbp3kOv8J0TQ9T7c9XXTzcaGPNw9Z2YUGgSGaWd61uv
V4/0altn0/50Q7njZCs/T657bRjAiqDpLgqg2U0l59yr6YK3iP/HVaQBb2pyvc9U
1IewhszNTByZi9eNZjdQLDmr+Up7DimAvrmMxTAjahFmB2d98r64bb2Lp/xNTKCm
Q5iTxKzyL54mbI9ez5DA59HInq0Vsc7OcG3e880VUrIdn3oBCLLDO/G2X7B1iHFl
QiaTrpZRQQ6lOENO+rVUk6Gh11b+C7DH2011Sq2e0k0NBsEMotFlzPW4fxymBfaz
y4DxXWAfGkR2Mc3nQjFyMB9wPtW30uzShxOLrnXIqlN1yysPcxWMbCzkE1yb6oND
9Pr6YdOWgstIDN8WI5m0iSEuzmNmZK7GOpf86essXgH/xEZ1EWRWAblIZr/8L7+n
LZQerMXyGpvXuXmAEMgQ6jq71DjLrCK2bUX1lMtoV7dQF9IKdFe6Nu1JBi7gpqX9
Aq13bA4cfTP2PKHQP3lJ
=wo4b
-----END PGP SIGNATURE-----
--- End Message ---