Hello community,

here is the log from the commit of package python-django-tastypie for 
openSUSE:Factory checked in at 2018-08-24 17:10:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-tastypie (Old)
 and      /work/SRC/openSUSE:Factory/.python-django-tastypie.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-django-tastypie"

Fri Aug 24 17:10:59 2018 rev:12 rq:631083 version:0.14.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-django-tastypie/python-django-tastypie.changes
    2016-03-07 13:23:34.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-django-tastypie.new/python-django-tastypie.changes
       2018-08-24 17:11:01.270564722 +0200
@@ -1,0 +2,14 @@
+Thu Aug 16 11:13:09 UTC 2018 - jeng...@inai.de
+
+- Replace useless description.
+
+-------------------------------------------------------------------
+Tue Aug 14 07:19:58 UTC 2018 - tchva...@suse.com
+
+- Version update to 0.14.1:
+  * Fixes to support latest django
+- Run tests
+- Add patch for django 2.1:
+  * django-tastypie-django21.patch
+
+-------------------------------------------------------------------

Old:
----
  django-tastypie-0.12.1.tar.gz

New:
----
  django-tastypie-django21.patch
  v0.14.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-django-tastypie.spec ++++++
--- /var/tmp/diff_new_pack.EiWWTM/_old  2018-08-24 17:11:01.726565265 +0200
+++ /var/tmp/diff_new_pack.EiWWTM/_new  2018-08-24 17:11:01.726565265 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-django-tastypie
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,45 +16,71 @@
 #
 
 
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-django-tastypie
-Version:        0.12.1
+Version:        0.14.1
 Release:        0
-Url:            http://github.com/toastdriven/django-tastypie/
-Summary:        A flexible & capable API layer for Django
+Summary:        A webservice API framework layer for Django
 License:        BSD-3-Clause
 Group:          Development/Languages/Python
-Source:         
http://pypi.python.org/packages/source/d/django-tastypie/django-tastypie-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  python-devel
-BuildRequires:  python-setuptools
-Requires:       python-django >= 1.2
-Requires:       python-mimeparse >= 0.1.3
-Requires:       python-python-dateutil >= 1.5
-Recommends:     python-lxml
+URL:            https://github.com/django-tastypie/django-tastypie
+Source:         
https://github.com/django-tastypie/django-tastypie/archive/v%{version}.tar.gz
+# https://github.com/django-tastypie/django-tastypie/pull/1562
+Patch0:         django-tastypie-django21.patch
+BuildRequires:  %{python_module Django >= 1.8}
+BuildRequires:  %{python_module PyYAML}
+BuildRequires:  %{python_module biplist}
+BuildRequires:  %{python_module defusedxml}
+BuildRequires:  %{python_module lxml}
+BuildRequires:  %{python_module mock}
+BuildRequires:  %{python_module python-dateutil >= 2.1}
+BuildRequires:  %{python_module python-mimeparse >= 0.1.4}
+BuildRequires:  %{python_module setuptools}
+BuildRequires:  fdupes
+BuildRequires:  python-rpm-macros
+Requires:       python-Django >= 1.8
+Requires:       python-python-dateutil >= 2.1
+Requires:       python-python-mimeparse >= 0.1.4
 Recommends:     python-PyYAML
 Recommends:     python-biplist
-Recommends:     python-python-digest
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
+Recommends:     python-defusedxml
+Recommends:     python-lxml
 BuildArch:      noarch
-%endif
+%python_subpackages
 
 %description
-Creating delicious APIs for Django apps since 2010.
+Tastypie is a webservice API framework for Django. It provides a
+customizable abstraction for creating REST-style interfaces.
 
 %prep
 %setup -q -n django-tastypie-%{version}
+%patch0 -p1
 
 %build
-python setup.py build
+%python_build
 
 %install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%python_install
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
 
-%files
-%defattr(-,root,root,-)
-%doc AUTHORS LICENSE README.rst docs/_build/html
+%check
+# The tests are doing what is specified in tox.ini
+%{python_expand export PYTHONPATH=./tests/
+$python -m django test -p '*' core.tests --settings=settings_core
+$python -m django test basic.tests --settings=settings_basic
+$python -m django test related_resource.tests --settings=settings_related
+$python -m django test alphanumeric.tests --settings=settings_alphanumeric
+$python -m django test authorization.tests --settings=settings_authorization
+$python -m django test content_gfk.tests --settings=settings_content_gfk
+$python -m django test customuser.tests --settings=settings_customuser
+$python -m django test namespaced.tests --settings=settings_namespaced
+$python -m django test slashless.tests --settings=settings_slashless
+$python -m django test validation.tests --settings=settings_validation
+}
+
+%files %{python_files}
+%license LICENSE
+%doc README.rst
 %{python_sitelib}/*
 
 %changelog

++++++ django-tastypie-django21.patch ++++++
>From 8bf1c5e0541b9f0ba90ab7c9df0a39e4e8ae967b Mon Sep 17 00:00:00 2001
From: Sam Thompson <georged...@users.noreply.github.com>
Date: Mon, 13 Aug 2018 07:40:55 -0700
Subject: [PATCH 2/4] Django 2.1: fix missing QUERY_TERMS (#1564)

* Isolate failing assertion in separate test

* query_terms: try interrogating the django field directly

* Replace class_lookups with get_lookups() which is a more complete list
---
 tastypie/resources.py         | 20 ++++++++++++++------
 tests/core/tests/resources.py | 12 +++++++++---
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/tastypie/resources.py b/tastypie/resources.py
index 607975cf..0ad0d921 100644
--- a/tastypie/resources.py
+++ b/tastypie/resources.py
@@ -13,11 +13,12 @@
 from django.conf import settings
 from django.conf.urls import url
 from django.core.exceptions import (
-    ObjectDoesNotExist, MultipleObjectsReturned, ValidationError,
+    ObjectDoesNotExist, MultipleObjectsReturned, ValidationError, 
FieldDoesNotExist
 )
 from django.core.signals import got_request_exception
 from django.core.exceptions import ImproperlyConfigured
 from django.db.models.fields.related import ForeignKey
+from django.db import models
 try:
     from django.contrib.gis.db.models.fields import GeometryField
 except (ImproperlyConfigured, ImportError):
@@ -29,7 +30,7 @@
 except ImportError:
     from django.db.models.fields.related_descriptors import\
         ReverseOneToOneDescriptor
-from django.db.models.sql.constants import QUERY_TERMS
+
 from django.http import HttpResponse, HttpResponseNotFound, Http404
 from django.utils import six
 from django.utils.cache import patch_cache_control, patch_vary_headers
@@ -2018,6 +2019,7 @@ def check_filtering(self, field_name, 
filter_type='exact', filter_bits=None):
         # Check to see if it's a relational lookup and if that's allowed.
         if len(filter_bits):
             if not getattr(self.fields[field_name], 'is_related', False):
+                print(field_name, filter_type, filter_bits)
                 raise InvalidFilterError("The '%s' field does not support 
relations." % field_name)
 
             if not self._meta.filtering[field_name] == ALL_WITH_RELATIONS:
@@ -2075,10 +2077,6 @@ def build_filters(self, filters=None, 
ignore_bad_filters=False):
 
         qs_filters = {}
 
-        query_terms = QUERY_TERMS
-        if django.VERSION >= (1, 8) and GeometryField:
-            query_terms |= set(GeometryField.class_lookups.keys())
-
         for filter_expr, value in filters.items():
             filter_bits = filter_expr.split(LOOKUP_SEP)
             field_name = filter_bits.pop(0)
@@ -2088,6 +2086,16 @@ def build_filters(self, filters=None, 
ignore_bad_filters=False):
                 # It's not a field we know about. Move along citizen.
                 continue
 
+            # Validate filter types other than 'exact' that are supported by 
the field type
+            try:
+                django_field_name = self.fields[field_name].attribute
+                django_field = 
self._meta.object_class._meta.get_field(django_field_name)
+                if hasattr(django_field, 'field'):
+                    django_field = django_field.field  # related field
+            except FieldDoesNotExist:
+                raise InvalidFilterError("The '%s' field is not a valid field 
name" % field_name)
+
+            query_terms = django_field.get_lookups().keys()
             if len(filter_bits) and filter_bits[-1] in query_terms:
                 filter_type = filter_bits.pop()
 
diff --git a/tests/core/tests/resources.py b/tests/core/tests/resources.py
index f096a799..1c3bc0c0 100644
--- a/tests/core/tests/resources.py
+++ b/tests/core/tests/resources.py
@@ -2102,13 +2102,19 @@ def test_build_filters(self):
         resource_4 = AnotherSubjectResource()
         
self.assertEqual(resource_4.build_filters(filters={'notes__user__startswith': 
'Daniel'}), {'notes__author__startswith': 'Daniel'})
 
-        # Make sure that fields that don't have attributes can't be filtered 
on.
-        self.assertRaises(InvalidFilterError, resource_4.build_filters, 
filters={'notes__hello_world': 'News'})
-
         # Make sure build_filters works even on resources without queryset
         resource = NoQuerysetNoteResource()
         self.assertEqual(resource.build_filters(), {})
 
+    def test_build_filters_bad(self):
+        """
+        Test that a nonsensical filter fails validation.
+        """
+        resource = AnotherSubjectResource()
+        # Make sure that fields that don't have attributes can't be filtered 
on.
+        self.assertRaises(InvalidFilterError, resource.build_filters, 
filters={'notes__hello_world': 'News'})
+
+
     def test_custom_build_filters(self):
         """
         A test derived from an example in the documentation (under Advanced 
Filtering).

>From d9a732c2f1b6738c5dde5cb37f0f5e1e365f6422 Mon Sep 17 00:00:00 2001
From: Sam Thompson <georged...@gmail.com>
Date: Mon, 13 Aug 2018 07:43:08 -0700
Subject: [PATCH 3/4] Leftover debug

---
 tastypie/resources.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tastypie/resources.py b/tastypie/resources.py
index 0ad0d921..4de667e7 100644
--- a/tastypie/resources.py
+++ b/tastypie/resources.py
@@ -2019,7 +2019,6 @@ def check_filtering(self, field_name, 
filter_type='exact', filter_bits=None):
         # Check to see if it's a relational lookup and if that's allowed.
         if len(filter_bits):
             if not getattr(self.fields[field_name], 'is_related', False):
-                print(field_name, filter_type, filter_bits)
                 raise InvalidFilterError("The '%s' field does not support 
relations." % field_name)
 
             if not self._meta.filtering[field_name] == ALL_WITH_RELATIONS:

>From 9dd62f4b9687cc7510a05a3ce55ef089c1b3894d Mon Sep 17 00:00:00 2001
From: Sam Thompson <georged...@users.noreply.github.com>
Date: Mon, 20 Aug 2018 07:21:32 -0700
Subject: [PATCH] Django 2.1: explicitly set blank=True on BooleanFields due to
 upstream regression (#1567)

Failing tests unrelated to this PR; those will need another compat shim (and 
pep8).
---
 tests/core/models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/core/models.py b/tests/core/models.py
index 91498e8d..c41cab36 100644
--- a/tests/core/models.py
+++ b/tests/core/models.py
@@ -22,7 +22,7 @@ class Note(models.Model):
     title = models.CharField("The Title", max_length=100)
     slug = models.SlugField()
     content = models.TextField(blank=True)
-    is_active = models.BooleanField(default=True)
+    is_active = models.BooleanField(default=True, blank=True)
     created = models.DateTimeField(default=now)
     updated = models.DateTimeField(default=now)
 
@@ -86,7 +86,7 @@ class AutoNowNote(models.Model):
     title = models.CharField(max_length=100)
     slug = models.SlugField(unique=True)
     content = models.TextField(blank=True)
-    is_active = models.BooleanField(default=True)
+    is_active = models.BooleanField(default=True, blank=True)
     created = models.DateTimeField(auto_now_add=now, null=True)
     updated = models.DateTimeField(auto_now=now)
 

Reply via email to