debian/0000755000000000000000000000000012302376331007166 5ustar debian/docs0000644000000000000000000000001411340516104010027 0ustar AUTHORS.txt debian/copyright0000644000000000000000000001702411530225661011126 0ustar This work was packaged for Debian by: Michael Ziegler on Mon, 22 Feb 2010 08:43:21 +0100 It was downloaded from: http://bitbucket.org/jespern/django-piston/wiki/Home Upstream Author: Jesper Noehr Copyright: License: The BSD License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Piston Developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== The file piston/decorator.py is the Decorator library by Michele Simionato. Upstream Author: Michele Simionato Copyright: License: This software is licensed under the 2-clause BSD license. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in bytecode form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== The file tests/bootstrap.py is copyright to the Zope Corporation and licensed under the ZPL. Copyright: License: Zope Public License (ZPL) Version 2.1 ------------------------------------- A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== The Debian packaging is: Copyright (C) 2010 Michael Ziegler Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Mumble Developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/changelog0000644000000000000000000000463612302376331011051 0ustar python-django-piston (0.2.3-1ubuntu5) trusty; urgency=medium * Rebuild to drop files installed into /usr/share/pyshared. -- Matthias Klose Sun, 23 Feb 2014 13:51:21 +0000 python-django-piston (0.2.3-1ubuntu4) trusty; urgency=low * debian/patches/06-django1.6-wsgirequest-compat.patch: Compatibility with Django 1.6 for WSGIRequest. (LP: #1256957) -- Andres Rodriguez Mon, 02 Dec 2013 13:32:02 -0500 python-django-piston (0.2.3-1ubuntu3) saucy; urgency=low * Compatibility with Django 1.5: - 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) -- Andres Rodriguez Tue, 28 May 2013 11:50:31 -0400 python-django-piston (0.2.3-1ubuntu2) quantal-proposed; urgency=low * debian/patches (Cherry picked from upstream to support Django 1.4): - 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. -- Andres Rodriguez Wed, 27 Jun 2012 12:56:30 -0400 python-django-piston (0.2.3-1ubuntu1) precise; urgency=low * debian/{control,rules}: Transition to dh python2. -- Dave Walker (Daviey) Mon, 19 Mar 2012 22:40:27 +0000 python-django-piston (0.2.3-1) unstable; urgency=low * New upstream release. * Remove the security patches as they have been applied upstream. * Adapt 01-fix-oauth-import.diff to reflect upstream changes. -- Michael Ziegler Sat, 12 Nov 2011 12:05:07 +0100 python-django-piston (0.2.2-2) unstable; urgency=low [ Michael Ziegler ] * Bump Standards Version to 3.9.2. * Remove reference to /usr/share/common-licenses/BSD and strip trailing whitespace in copyright. * Fix a copy-paste error in copyright. * Fix a security issue in the YAML emitter. * Disable the pickle loader due to security concerns (Closes: #646517). [ Luca Falavigna ] * Enable DM-Upload-Allowed field. -- Michael Ziegler Tue, 01 Nov 2011 19:37:58 +0100 python-django-piston (0.2.2-1) unstable; urgency=low * Initial release (Closes: #570919) -- Michael Ziegler Thu, 10 Jun 2010 10:40:58 +0200 debian/source.lintian-overrides0000644000000000000000000000010211340516104014032 0ustar python-django-piston source: source-contains-hg-tags-file .hgtags debian/compat0000644000000000000000000000000211340516104010357 0ustar 7 debian/patches/0000755000000000000000000000000012247151502010614 5ustar debian/patches/01-fix-oauth-import.diff0000644000000000000000000000222711657465622015122 0ustar Description: Fix the oauth import to work correctly with the python-oauth Debian package. Forwarded: not-needed Author: Michael Ziegler Index: python-django-piston-0.2.3/piston/authentication.py =================================================================== --- python-django-piston-0.2.3.orig/piston/authentication.py 2011-11-01 14:52:13.000000000 +0100 +++ python-django-piston-0.2.3/piston/authentication.py 2011-11-12 13:50:23.899726540 +0100 @@ -1,6 +1,6 @@ import binascii -import oauth +from oauth import oauth from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.decorators import login_required Index: python-django-piston-0.2.3/piston/store.py =================================================================== --- python-django-piston-0.2.3.orig/piston/store.py 2011-11-01 14:52:13.000000000 +0100 +++ python-django-piston-0.2.3/piston/store.py 2011-11-12 13:50:23.900726539 +0100 @@ -1,4 +1,4 @@ -import oauth +from oauth import oauth from models import Nonce, Token, Consumer from models import generate_random, VERIFIER_SIZE debian/patches/03-django1.4-support.patch0000644000000000000000000000446011772635151015271 0ustar 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 = ( debian/patches/06-django1.6-wsgirequest-compat.patch0000644000000000000000000000157712247151502017422 0ustar From: Raphael Badin 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. debian/patches/04-json-compat-django1.5.patch0000644000000000000000000000410712151153422015773 0ustar 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): """ debian/patches/05-compat-django1.5-httpresponsewrapper.patch0000644000000000000000000000216012151154214021157 0ustar 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) debian/patches/series0000644000000000000000000000030512247151313012027 0ustar 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 debian/patches/02-correct-httpresponse.patch0000644000000000000000000001105411772635240016262 0ustar 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) debian/control0000644000000000000000000000311611731733032010572 0ustar Source: python-django-piston Section: python Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Python Modules Team Uploaders: Michael Ziegler Build-Depends: python (>= 2.6.6-3~), debhelper (>= 7.0.50~), python-setuptools (>= 0.6.10) Standards-Version: 3.9.2 Homepage: http://bitbucket.org/jespern/django-piston/wiki/ Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-django-piston/trunk/ Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/python-django-piston/trunk DM-Upload-Allowed: yes Package: python-django-piston Architecture: all Depends: ${misc:Depends}, ${python:Depends}, python-django (>= 1.1), python-oauth (>= 1.0.1), python-decorator Suggests: python-yaml Description: Django mini-framework creating RESTful APIs Piston is a relatively small Django application that lets you create application programming interfaces (API) for your sites. . It has several unique features: . * Ties into Django's internal mechanisms. * Supports OAuth out of the box (as well as Basic/Digest or custom auth). * Doesn't require tying to models, allowing arbitrary resources. * Speaks JSON, YAML, Python Pickle & XML (and HATEOAS). * Ships with a convenient reusable library in Python. * Respects and encourages proper use of HTTP (status codes, ...). * Has built in (optional) form validation (via Django), throttling, etc. * Supports streaming, with a small memory footprint. * Stays out of your way. debian/rules0000755000000000000000000000043511731734736010264 0ustar #!/usr/bin/make -f # -*- makefile -*- #export DH_VERBOSE=1 override_dh_auto_install: dh_auto_install rm debian/python-django-piston/usr/lib/python*/*-packages/piston/oauth.py rm debian/python-django-piston/usr/lib/python*/*-packages/piston/decorator.py %: dh $@ --with python2 debian/source/0000755000000000000000000000000011657465725010510 5ustar debian/source/format0000644000000000000000000000001411340516104011667 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000037411340516553010226 0ustar version=3 opts=filenamemangle=s#/jespern/django-piston/get/([\d\.]*)\.tar\.bz2#python-django-piston_$1\.orig\.tar\.bz2# \ http://bitbucket.org/jespern/django-piston/downloads/ \ /jespern/django-piston/get/([\d\.]*)\.tar\.bz2 \ debian svn-upgrade