python-django-jsonfield (1.0.1-2) unstable; urgency=medium

* Add patch for Django 1.10 compatility. Closes: #828668

[dgit import unpatched python-django-jsonfield 1.0.1-2]
This commit is contained in:
Raphaël Hertzog 2016-08-18 14:21:22 +02:00
commit 5aadd114e1
13 changed files with 322 additions and 0 deletions

11
debian/.git-dpm vendored Normal file
View File

@ -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"

86
debian/changelog vendored Normal file
View File

@ -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 <hertzog@debian.org> 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 <hertzog@debian.org> 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 <hertzog@debian.org> 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 <hertzog@debian.org> Wed, 22 Jun 2016 20:19:10 +0200
python-django-jsonfield (0.9.19-1) unstable; urgency=medium
* New upstream version.
-- Brian May <bam@debian.org> 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 <bam@debian.org> 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 <hertzog@debian.org> 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 <bam@debian.org> 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 <bam@debian.org> Mon, 07 Jul 2014 08:58:49 +1000
python-django-jsonfield (0.9.12-3) unstable; urgency=low
* Python3 package. Closes: #753462.
-- Brian May <bam@debian.org> 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 <hertzog@debian.org> 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 <hertzog@debian.org> 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 <hertzog@debian.org> Thu, 25 Jul 2013 14:51:15 +0200

1
debian/clean vendored Normal file
View File

@ -0,0 +1 @@
tests.db

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

48
debian/control vendored Normal file
View File

@ -0,0 +1,48 @@
Source: python-django-jsonfield
Section: python
Priority: optional
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Uploaders: Raphaël Hertzog <hertzog@debian.org>, Brian May <bam@debian.org>
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.

34
debian/copyright vendored Normal file
View File

@ -0,0 +1,34 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: django-jsonfield
Upstream-Contact: Matthew Schinckel <matt@schinckel.net>
Source: https://pypi.python.org/pypi/django-jsonfield/
Files: *
Copyright: 2012 Matthew Schinckel <matt@schinckel.net>
License: BSD-3-Clause
Files: debian/*
Copyright: 2012 Raphaël Hertzog <hertzog@debian.org>
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.

1
debian/docs vendored Normal file
View File

@ -0,0 +1 @@
README.rst

99
debian/patches/django-1.10-compat.patch vendored Normal file
View File

@ -0,0 +1,99 @@
From 68a74fd8f5cc0ce0778bda680b3ca005e68b9530 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
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):
"""

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
django-1.10-compat.patch

11
debian/rules vendored Executable file
View File

@ -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

26
debian/run_tests.py vendored Normal file
View File

@ -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')

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

2
debian/watch vendored Normal file
View File

@ -0,0 +1,2 @@
version=3
http://pypi.debian.net/django-jsonfield/ .*/django-jsonfield-(.+).tar.gz