commit bf34dff3183167bed59de35a71660510155da34a Author: Raphaël Hertzog Date: Thu Aug 18 14:21:22 2016 +0200 Import python-django-jsonfield_1.0.1-2.debian.tar.xz [dgit import tarball python-django-jsonfield 1.0.1-2 python-django-jsonfield_1.0.1-2.debian.tar.xz] diff --git a/.git-dpm b/.git-dpm new file mode 100644 index 0000000..9cd2725 --- /dev/null +++ b/.git-dpm @@ -0,0 +1,11 @@ +# see git-dpm(1) from git-dpm package +0a81b60f9ee97095a6279e8f4b374e91edbfe820 +0a81b60f9ee97095a6279e8f4b374e91edbfe820 +0a81b60f9ee97095a6279e8f4b374e91edbfe820 +0a81b60f9ee97095a6279e8f4b374e91edbfe820 +python-django-jsonfield_1.0.1.orig.tar.gz +9330d73346d51341105c20a6094b36cf94cb3fac +13328 +debianTag="debian/%e%v" +patchedTag="patched/%e%v" +upstreamTag="upstream/%e%u" diff --git a/changelog b/changelog new file mode 100644 index 0000000..3ced85f --- /dev/null +++ b/changelog @@ -0,0 +1,86 @@ +python-django-jsonfield (1.0.1-2) unstable; urgency=medium + + * Add patch for Django 1.10 compatility. Closes: #828668 + + -- Raphaël Hertzog Thu, 18 Aug 2016 14:21:22 +0200 + +python-django-jsonfield (1.0.1-1) unstable; urgency=medium + + * New upstream release incorporating the latest patch for proper support of + PostgreSQL >= 9.4. + + -- Raphaël Hertzog Thu, 21 Jul 2016 10:45:17 +0200 + +python-django-jsonfield (1.0.0-2) unstable; urgency=medium + + * Add patch to avoid failures with PostgreSQL >= 9.4. + + -- Raphaël Hertzog Tue, 28 Jun 2016 17:44:54 +0200 + +python-django-jsonfield (1.0.0-1) unstable; urgency=medium + + * New upstream version. Compatible with Django 1.8 and 1.9 without warnings. + * Bump Standards-Version to 3.9.8. + + -- Raphaël Hertzog Wed, 22 Jun 2016 20:19:10 +0200 + +python-django-jsonfield (0.9.19-1) unstable; urgency=medium + + * New upstream version. + + -- Brian May Wed, 06 Apr 2016 13:44:35 +1000 + +python-django-jsonfield (0.9.15-2) unstable; urgency=medium + + * Fix broken depends. Closes: #810895. + + -- Brian May Thu, 14 Jan 2016 10:53:56 +1100 + +python-django-jsonfield (0.9.15-1) unstable; urgency=medium + + * New upstream release, compatible with Django 1.7 and 1.8. + Closes: #801942 + * Bump Standards-Version to 3.9.6. + + -- Raphaël Hertzog Mon, 19 Oct 2015 20:42:44 +0200 + +python-django-jsonfield (0.9.13-2) unstable; urgency=low + + * Fix Django 1.7 AppRegistryNotReady error, by calling django.setup() in + tests. Closes: #763240. + + -- Brian May Mon, 29 Sep 2014 12:04:08 +1000 + +python-django-jsonfield (0.9.13-1) unstable; urgency=low + + * New upstream release. + * Python3 patch no longer required; deleted. + + -- Brian May Mon, 07 Jul 2014 08:58:49 +1000 + +python-django-jsonfield (0.9.12-3) unstable; urgency=low + + * Python3 package. Closes: #753462. + + -- Brian May Wed, 02 Jul 2014 16:15:14 +1000 + +python-django-jsonfield (0.9.12-2) unstable; urgency=medium + + * Add python-django to Build-Depends to fix test suite run. + + -- Raphaël Hertzog Fri, 24 Jan 2014 21:02:27 +0100 + +python-django-jsonfield (0.9.12-1) unstable; urgency=high + + * New upstream version. + * Compatible with Django 1.6 (which is already in testing, hence the + severity). + * Switch to pybuild in anticipation of Python 3 support. + + -- Raphaël Hertzog Tue, 21 Jan 2014 08:43:20 +0100 + +python-django-jsonfield (0.9.10-1) unstable; urgency=low + + * Initial release. Closes: #717830 + + -- Raphaël Hertzog Thu, 25 Jul 2013 14:51:15 +0200 diff --git a/clean b/clean new file mode 100644 index 0000000..177e0b6 --- /dev/null +++ b/clean @@ -0,0 +1 @@ +tests.db diff --git a/compat b/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/compat @@ -0,0 +1 @@ +9 diff --git a/control b/control new file mode 100644 index 0000000..40e0923 --- /dev/null +++ b/control @@ -0,0 +1,48 @@ +Source: python-django-jsonfield +Section: python +Priority: optional +Maintainer: Debian Python Modules Team +Uploaders: Raphaël Hertzog , Brian May +Standards-Version: 3.9.8 +Build-Depends: + debhelper (>= 9), + dh-python, + python-all, + python-django, + python-setuptools, + python-six, + python3-all, + python3-django, + python3-setuptools, + python3-six +Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/python-django-jsonfield.git +Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/python-django-jsonfield.git +Homepage: https://bitbucket.org/schinckel/django-jsonfield/ + +Package: python-django-jsonfield +Architecture: all +Depends: python-django (>= 1.3), ${misc:Depends}, ${python:Depends} +Description: JSON field for Django models (Python 2) + This package provides a Django field (jsonfield.JSONField) that you can use to + store arbitrary JSON structures in a simple text field at the database level. + . + Accessing the field returns a decoded object (list, dict, string). + . + In forms, it appears like a TextField but the input is validated to be valid + JSON. + . + This is the Python 2 version of the package. + +Package: python3-django-jsonfield +Architecture: all +Depends: python3-django (>= 1.3), ${misc:Depends}, ${python3:Depends} +Description: JSON field for Django models (Python 3) + This package provides a Django field (jsonfield.JSONField) that you can use to + store arbitrary JSON structures in a simple text field at the database level. + . + Accessing the field returns a decoded object (list, dict, string). + . + In forms, it appears like a TextField but the input is validated to be valid + JSON. + . + This is the Python 3 version of the package. diff --git a/copyright b/copyright new file mode 100644 index 0000000..2778a53 --- /dev/null +++ b/copyright @@ -0,0 +1,34 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: django-jsonfield +Upstream-Contact: Matthew Schinckel +Source: https://pypi.python.org/pypi/django-jsonfield/ + +Files: * +Copyright: 2012 Matthew Schinckel +License: BSD-3-Clause + +Files: debian/* +Copyright: 2012 Raphaël Hertzog +License: BSD-3-Clause + +License: BSD-3-Clause + 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. + * 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 MATTHEW SCHINCKEL 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. diff --git a/docs b/docs new file mode 100644 index 0000000..a1320b1 --- /dev/null +++ b/docs @@ -0,0 +1 @@ +README.rst diff --git a/patches/django-1.10-compat.patch b/patches/django-1.10-compat.patch new file mode 100644 index 0000000..c0a9d2f --- /dev/null +++ b/patches/django-1.10-compat.patch @@ -0,0 +1,99 @@ +From 68a74fd8f5cc0ce0778bda680b3ca005e68b9530 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= +Date: Thu, 18 Aug 2016 14:14:44 +0200 +Subject: Register explicit lookup operators + +Django 1.10 dropped support for Field.get_prep_lookup() and we need +to register explicit lookup operators overriding the default operators +to have our desired behaviour. + +Fix #56 + +Bug: https://bitbucket.org/schinckel/django-jsonfield/issues/56/unit-test-test_query_object-fails-with +Bug-Debian: https://bugs.debian.org/828668 +Applied-Upstream: 1.0.2 +--- + jsonfield/fields.py | 59 +++++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 44 insertions(+), 15 deletions(-) + +diff --git a/jsonfield/fields.py b/jsonfield/fields.py +index befef2c..dd390ef 100644 +--- a/jsonfield/fields.py ++++ b/jsonfield/fields.py +@@ -4,6 +4,7 @@ import json + from django.core.exceptions import ValidationError + from django.conf import settings + from django.db import models ++from django.db.models.lookups import Exact, IExact, In, Contains, IContains + from django.db.backends.signals import connection_created + from django.utils.translation import ugettext_lazy as _ + from django.utils import six +@@ -95,25 +96,53 @@ class JSONField(models.Field): + return None + return json.dumps(value, **self.encoder_kwargs) + +- def get_prep_lookup(self, lookup_type, value): +- if lookup_type in ["exact", "iexact", "in", "isnull"]: +- return value +- if lookup_type in ["contains", "icontains"]: +- if isinstance(value, (list, tuple)): +- raise TypeError("Lookup type %r not supported with argument of %s" % ( +- lookup_type, type(value).__name__ +- )) +- # Need a way co combine the values with '%', but don't escape that. +- return self.get_prep_value(value)[1:-1].replace(', ', r'%') +- if isinstance(value, dict): +- return self.get_prep_value(value)[1:-1] +- return self.get_prep_value(value) +- raise TypeError('Lookup type %r not supported' % lookup_type) +- + def value_to_string(self, obj): + return self._get_val_from_obj(obj) + + ++class NoPrepareMixin(object): ++ def get_prep_lookup(self): ++ return self.rhs ++ ++ ++class JSONFieldExactLookup(NoPrepareMixin, Exact): ++ pass ++ ++ ++class JSONFieldIExactLookup(NoPrepareMixin, IExact): ++ pass ++ ++ ++class JSONFieldInLookup(NoPrepareMixin, In): ++ pass ++ ++ ++class ContainsLookupMixin(object): ++ def get_prep_lookup(self): ++ if isinstance(self.rhs, (list, tuple)): ++ raise TypeError("Lookup type %r not supported with %s argument" % ( ++ self.lookup_name, type(self.rhs).__name__ ++ )) ++ if isinstance(self.rhs, dict): ++ return self.lhs.output_field.get_prep_value(self.rhs)[1:-1] ++ return self.lhs.output_field.get_prep_value(self.rhs) ++ ++ ++class JSONFieldContainsLookup(ContainsLookupMixin, Contains): ++ pass ++ ++ ++class JSONFieldIContainsLookup(ContainsLookupMixin, IContains): ++ pass ++ ++ ++JSONField.register_lookup(JSONFieldExactLookup) ++JSONField.register_lookup(JSONFieldIExactLookup) ++JSONField.register_lookup(JSONFieldInLookup) ++JSONField.register_lookup(JSONFieldContainsLookup) ++JSONField.register_lookup(JSONFieldIContainsLookup) ++ ++ + class TypedJSONField(JSONField): + """ + diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..a6dd669 --- /dev/null +++ b/patches/series @@ -0,0 +1 @@ +django-1.10-compat.patch diff --git a/rules b/rules new file mode 100755 index 0000000..78b4d8f --- /dev/null +++ b/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=django-jsonfield + +%: + dh $@ --with python2,python3 --buildsystem=pybuild + +.PHONY: override_dh_auto_test +override_dh_auto_test: + python2 debian/run_tests.py + python3 debian/run_tests.py diff --git a/run_tests.py b/run_tests.py new file mode 100644 index 0000000..71208a0 --- /dev/null +++ b/run_tests.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import os +import sys +sys.path.insert(0, os.getcwd()) + +from django.conf import settings +settings.configure( + INSTALLED_APPS=['jsonfield'], + DATABASES={ + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'tests.db', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', + 'PORT': '', + } + } +) + +import django +django.setup() + +from django.core import management +management.call_command('test') diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/watch b/watch new file mode 100644 index 0000000..cf3cb26 --- /dev/null +++ b/watch @@ -0,0 +1,2 @@ +version=3 +http://pypi.debian.net/django-jsonfield/ .*/django-jsonfield-(.+).tar.gz