Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-django-guardian for 
openSUSE:Factory checked in at 2021-12-09 19:46:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-guardian (Old)
 and      /work/SRC/openSUSE:Factory/.python-django-guardian.new.2520 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-django-guardian"

Thu Dec  9 19:46:03 2021 rev:19 rq:938240 version:2.4.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-django-guardian/python-django-guardian.changes
    2021-05-15 01:24:52.158881252 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-django-guardian.new.2520/python-django-guardian.changes
  2021-12-09 19:46:50.421168812 +0100
@@ -1,0 +2,11 @@
+Thu Dec  9 09:00:31 UTC 2021 - pgaj...@suse.com
+
+- version update to 2.4.0
+  * Add support for Python 3.9
+  * Add support for Django 3.1, Django 3.2
+  * Add parameter `any_perm` to `PermissionRequiredMixin`
+  * Switch from Travis CI to `GitHub Actions`_
+- deleted patches
+  - django32.patch (upstreamed)
+
+-------------------------------------------------------------------

Old:
----
  django-guardian-2.3.0.tar.gz
  django32.patch

New:
----
  django-guardian-2.4.0.tar.gz

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

Other differences:
------------------
++++++ python-django-guardian.spec ++++++
--- /var/tmp/diff_new_pack.noCHPw/_old  2021-12-09 19:46:51.005169094 +0100
+++ /var/tmp/diff_new_pack.noCHPw/_new  2021-12-09 19:46:51.005169094 +0100
@@ -1,5 +1,5 @@
 #
-# spec file for package python-django-guardian
+# spec file
 #
 # Copyright (c) 2021 SUSE LLC
 #
@@ -19,18 +19,16 @@
 %define pypi_package_name django-guardian
 %define skip_python2 1
 Name:           python-%{pypi_package_name}
-Version:        2.3.0
+Version:        2.4.0
 Release:        0
 Summary:        Implementation of per object permissions for Django
 License:        BSD-3-Clause
 URL:            https://github.com/lukaszb/django-guardian
 Source:         
https://files.pythonhosted.org/packages/source/d/django-guardian/django-guardian-%{version}.tar.gz
-Patch0:         django32.patch
 BuildRequires:  %{python_module Django >= 2.2}
 BuildRequires:  %{python_module django-environ}
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pytest-django}
-BuildRequires:  %{python_module pytest-runner}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros

++++++ django-guardian-2.3.0.tar.gz -> django-guardian-2.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/.gitignore 
new/django-guardian-2.4.0/.gitignore
--- old/django-guardian-2.3.0/.gitignore        2019-06-11 11:38:51.000000000 
+0200
+++ new/django-guardian-2.4.0/.gitignore        1970-01-01 01:00:00.000000000 
+0100
@@ -1,30 +0,0 @@
-guardian/version.py
-*.pyc
-*.log
-*.egg
-*.egg-info
-*.swp
-*.bak
-*.db
-*.orig
-build
-_build
-dist
-.DS_Store
-.coverage
-.hgignore
-.tox
-.ropeproject
-
-example_project/media
-example_project/conf/*.py
-.idea/
-.eggs/
-.cache/
-.mypy_cache/
-.pytest_cache/
-
-# WebDAV remote filesystem
-.DAV
-.project
-.pydevproject
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/.isort.cfg 
new/django-guardian-2.4.0/.isort.cfg
--- old/django-guardian-2.3.0/.isort.cfg        2019-06-11 11:38:51.000000000 
+0200
+++ new/django-guardian-2.4.0/.isort.cfg        1970-01-01 01:00:00.000000000 
+0100
@@ -1,4 +0,0 @@
-[settings]
-line_length=120
-force_single_line=False
-force_alphabetical_sort=True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/.travis.yml 
new/django-guardian-2.4.0/.travis.yml
--- old/django-guardian-2.3.0/.travis.yml       2020-06-08 01:49:56.000000000 
+0200
+++ new/django-guardian-2.4.0/.travis.yml       1970-01-01 01:00:00.000000000 
+0100
@@ -1,69 +0,0 @@
-language: python
-dist: xenial
-
-cache: pip
-
-install:
-  - ./contrib/travis/install.sh
-
-script:
-  - ./contrib/travis/test.sh
-
-notifications:
-  irc: "irc.freenode.net#django-guardian"
-
-templates:
-  django22: &django22 DJANGO_VERSION=2.2.*
-  django30: &django30 DJANGO_VERSION=3.0.*
-  djangomaster: &djangomaster DJANGO_VERSION=master
-
-  postgres: &postgres DATABASE_URL=postgres://postgres@/django_guardian
-  mysql: &mysql DATABASE_URL=mysql://root:@localhost/django_guardian
-  sqlite: &sqlite  DATABASE_URL=sqlite://
-
-  pgdb: &pgdb
-    addons: {postgresql: "10"}
-  mariadb: &mariadb
-    addons: {mariadb: "10.3"}
-
-
-matrix:
-  fast_finish: true
-  include:
-    - { python: 3.5, env: [*django22, *postgres], <<: *pgdb}
-    - { python: 3.5, env: [*django22, *mysql], <<: *mariadb}
-    - { python: 3.5, env: [*django22, *sqlite]}
-
-    - { python: 3.6, env: [*django22, *postgres], <<: *pgdb}
-    - { python: 3.6, env: [*django22, *mysql], <<: *mariadb}
-    - { python: 3.6, env: [*django22, *sqlite]}
-    - { python: 3.6, env: [*django30, *postgres], <<: *pgdb}
-    - { python: 3.6, env: [*django30, *mysql], <<: *mariadb}
-    - { python: 3.6, env: [*django30, *sqlite]}
-    - { python: 3.6, env: [*djangomaster, *postgres], <<: *pgdb}
-    - { python: 3.6, env: [*djangomaster, *mysql], <<: *mariadb}
-    - { python: 3.6, env: [*djangomaster, *sqlite]}
-
-    - { python: 3.7, env: [*django22, *postgres], <<: *pgdb}
-    - { python: 3.7, env: [*django22, *mysql], <<: *mariadb}
-    - { python: 3.7, env: [*django22, *sqlite]}
-    - { python: 3.7, env: [*django30, *postgres], <<: *pgdb}
-    - { python: 3.7, env: [*django30, *mysql], <<: *mariadb}
-    - { python: 3.7, env: [*django30, *sqlite]}
-    - { python: 3.7, env: [*djangomaster, *postgres], <<: *pgdb}
-    - { python: 3.7, env: [*djangomaster, *mysql], <<: *mariadb}
-    - { python: 3.7, env: [*djangomaster, *sqlite]}
-
-    - { python: 3.8, env: [*django22, *postgres], <<: *pgdb}
-    - { python: 3.8, env: [*django22, *mysql], <<: *mariadb}
-    - { python: 3.8, env: [*django22, *sqlite]}
-    - { python: 3.8, env: [*django30, *postgres], <<: *pgdb}
-    - { python: 3.8, env: [*django30, *mysql], <<: *mariadb}
-    - { python: 3.8, env: [*django30, *sqlite]}
-    - { python: 3.8, env: [*djangomaster, *postgres], <<: *pgdb}
-    - { python: 3.8, env: [*djangomaster, *mysql], <<: *mariadb}
-    - { python: 3.8, env: [*djangomaster, *sqlite]}
-  allow_failures:
-    - env: [*djangomaster, *postgres]
-    - env: [*djangomaster, *mysql]
-    - env: [*djangomaster, *sqlite]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/AUTHORS 
new/django-guardian-2.4.0/AUTHORS
--- old/django-guardian-2.3.0/AUTHORS   2020-06-08 01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/AUTHORS   2021-05-23 23:59:25.000000000 +0200
@@ -61,3 +61,4 @@
 - Jonny Arnold <jonny.arnol...@gmail.com>
 - Davis Raymond Muro <davisraymondm...@gmail.com>
 - Richard de Wit <henk....@gmail.com>
+- Pedro Rojas Gavidia <pedrorojas.gavi...@gmail.com> @pedrorojasg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/CHANGES 
new/django-guardian-2.4.0/CHANGES
--- old/django-guardian-2.3.0/CHANGES   2020-06-08 01:50:13.000000000 +0200
+++ new/django-guardian-2.4.0/CHANGES   2021-05-24 00:07:27.000000000 +0200
@@ -1,3 +1,11 @@
+Release 2.4.0 (May 24, 2021)
+============================
+
+* Add support for Python 3.9
+* Add support for Django 3.1, Django 3.2
+* Add parameter `any_perm` to `PermissionRequiredMixin`
+* Switch from Travis CI to `GitHub Actions`_
+
 Release 2.3.0 (June 6, 2020)
 ===============================
 
@@ -435,6 +443,7 @@
 .. _grappelli: https://github.com/sehmaschine/django-grappelli
 .. _tox: http://tox.testrun.org/
 .. _travis: http://travis-ci.org/
+.. _GitHub Actions: https://github.com/django-guardian/django-guardian/actions
 
 
 .. vim: ft=rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/PKG-INFO 
new/django-guardian-2.4.0/PKG-INFO
--- old/django-guardian-2.3.0/PKG-INFO  2020-06-08 01:52:28.000000000 +0200
+++ new/django-guardian-2.4.0/PKG-INFO  2021-05-24 00:10:31.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: django-guardian
-Version: 2.3.0
+Version: 2.4.0
 Summary: Implementation of per object permissions for Django.
 Home-page: http://github.com/django-guardian/django-guardian
 Author: Lukasz Balcerzak
@@ -11,8 +11,8 @@
         django-guardian
         ===============
         
-        .. image:: 
https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
-          :target: https://travis-ci.org/django-guardian/django-guardian
+        .. image:: 
https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel
+          :target: 
https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml
         
         .. image:: https://img.shields.io/pypi/v/django-guardian.svg
             :target: https://pypi.python.org/pypi/django-guardian
@@ -34,7 +34,7 @@
         * Python 3.5+
         * A supported version of Django (currently 2.2+)
         
-        Travis CI tests on Django version 2.2, 3.0, and master.
+        GitHub Actions run tests against Django versions 2.2, 3.0, 3.1, 3.2, 
and main.
         
         Installation
         ------------
@@ -133,14 +133,18 @@
 Classifier: Framework :: Django
 Classifier: Framework :: Django :: 2.2
 Classifier: Framework :: Django :: 3.0
+Classifier: Framework :: Django :: 3.1
+Classifier: Framework :: Django :: 3.2
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Topic :: Security
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
-Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.9
 Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/README.rst 
new/django-guardian-2.4.0/README.rst
--- old/django-guardian-2.3.0/README.rst        2020-06-08 01:49:56.000000000 
+0200
+++ new/django-guardian-2.4.0/README.rst        2021-05-23 23:59:25.000000000 
+0200
@@ -2,8 +2,8 @@
 django-guardian
 ===============
 
-.. image:: 
https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
-  :target: https://travis-ci.org/django-guardian/django-guardian
+.. image:: 
https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel
+  :target: 
https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml
 
 .. image:: https://img.shields.io/pypi/v/django-guardian.svg
     :target: https://pypi.python.org/pypi/django-guardian
@@ -25,7 +25,7 @@
 * Python 3.5+
 * A supported version of Django (currently 2.2+)
 
-Travis CI tests on Django version 2.2, 3.0, and master.
+GitHub Actions run tests against Django versions 2.2, 3.0, 3.1, 3.2, and main.
 
 Installation
 ------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-guardian-2.3.0/django_guardian.egg-info/PKG-INFO 
new/django-guardian-2.4.0/django_guardian.egg-info/PKG-INFO
--- old/django-guardian-2.3.0/django_guardian.egg-info/PKG-INFO 2020-06-08 
01:52:27.000000000 +0200
+++ new/django-guardian-2.4.0/django_guardian.egg-info/PKG-INFO 2021-05-24 
00:10:31.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: django-guardian
-Version: 2.3.0
+Version: 2.4.0
 Summary: Implementation of per object permissions for Django.
 Home-page: http://github.com/django-guardian/django-guardian
 Author: Lukasz Balcerzak
@@ -11,8 +11,8 @@
         django-guardian
         ===============
         
-        .. image:: 
https://travis-ci.org/django-guardian/django-guardian.svg?branch=devel
-          :target: https://travis-ci.org/django-guardian/django-guardian
+        .. image:: 
https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel
+          :target: 
https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml
         
         .. image:: https://img.shields.io/pypi/v/django-guardian.svg
             :target: https://pypi.python.org/pypi/django-guardian
@@ -34,7 +34,7 @@
         * Python 3.5+
         * A supported version of Django (currently 2.2+)
         
-        Travis CI tests on Django version 2.2, 3.0, and master.
+        GitHub Actions run tests against Django versions 2.2, 3.0, 3.1, 3.2, 
and main.
         
         Installation
         ------------
@@ -133,14 +133,18 @@
 Classifier: Framework :: Django
 Classifier: Framework :: Django :: 2.2
 Classifier: Framework :: Django :: 3.0
+Classifier: Framework :: Django :: 3.1
+Classifier: Framework :: Django :: 3.2
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Topic :: Security
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
-Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.9
 Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-guardian-2.3.0/django_guardian.egg-info/SOURCES.txt 
new/django-guardian-2.4.0/django_guardian.egg-info/SOURCES.txt
--- old/django-guardian-2.3.0/django_guardian.egg-info/SOURCES.txt      
2020-06-08 01:52:28.000000000 +0200
+++ new/django-guardian-2.4.0/django_guardian.egg-info/SOURCES.txt      
2021-05-24 00:10:31.000000000 +0200
@@ -1,6 +1,3 @@
-.gitignore
-.isort.cfg
-.travis.yml
 AUTHORS
 CHANGES
 LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/docs/develop/testing.rst 
new/django-guardian-2.4.0/docs/develop/testing.rst
--- old/django-guardian-2.3.0/docs/develop/testing.rst  2019-12-20 
15:00:56.000000000 +0100
+++ new/django-guardian-2.4.0/docs/develop/testing.rst  2021-05-23 
23:59:25.000000000 +0200
@@ -100,21 +100,20 @@
 environments and pull dependencies) but would ensure everything is fine.
 
 
-Travis CI
----------
+GitHub Actions
+--------------
 
-.. versionadded:: 1.0.4
+.. versionadded:: 2.4.0
 
-.. image:: 
https://secure.travis-ci.org/django-guardian/django-guardian.png?branch=master
-  :target: http://travis-ci.org/django-guardian/django-guardian
+.. image:: 
https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel
+  :target: 
https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml
 
-Recently we have added support for Travis_, continuous integration server so it
-is even more easy to follow if test fails with new commits: 
http://travis-ci.org/#!/lukaszb/django-guardian.
+We have support for `GitHub Actions`_ to make it easy to follow
+if test fails with new commits.
 
 
 .. _owasp: http://www.owasp.org/
 .. _issue-tracker: http://github.com/lukaszb/django-guardian
 .. _coverage: http://nedbatchelder.com/code/coverage/
 .. _tox: http://pypi.python.org/pypi/tox
-.. _travis: http://travis-ci.org/
-
+.. _GitHub Actions: https://github.com/django-guardian/django-guardian/actions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/docs/index.rst 
new/django-guardian-2.4.0/docs/index.rst
--- old/django-guardian-2.3.0/docs/index.rst    2019-06-11 11:38:51.000000000 
+0200
+++ new/django-guardian-2.4.0/docs/index.rst    2021-05-23 23:59:25.000000000 
+0200
@@ -9,8 +9,8 @@
 
 **Documentation**:
 
-.. image:: 
https://secure.travis-ci.org/django-guardian/django-guardian.png?branch=master
-  :target: http://travis-ci.org/django-guardian/django-guardian
+.. image:: 
https://github.com/django-guardian/django-guardian/workflows/Tests/badge.svg?branch=devel
+  :target: 
https://github.com/django-guardian/django-guardian/actions/workflows/tests.yml
 
 .. toctree::
     :maxdepth: 2
@@ -30,4 +30,3 @@
 * :ref:`genindex`
 * :ref:`modindex`
 * :ref:`search`
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/docs/userguide/remove.rst 
new/django-guardian-2.4.0/docs/userguide/remove.rst
--- old/django-guardian-2.3.0/docs/userguide/remove.rst 2016-09-20 
21:18:43.000000000 +0200
+++ new/django-guardian-2.4.0/docs/userguide/remove.rst 2021-05-23 
23:59:25.000000000 +0200
@@ -4,7 +4,7 @@
 =========================
 
 Removing object permissions is as easy as assigning them. Just instead of
-:func:`guardian.shortcuts.assign` we would use
+:func:`guardian.shortcuts.assign_perm` we would use
 :func:`guardian.shortcuts.remove_perm` function (it accepts same arguments).
 
 Example
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/__init__.py 
new/django-guardian-2.4.0/guardian/__init__.py
--- old/django-guardian-2.3.0/guardian/__init__.py      2020-06-08 
01:50:55.000000000 +0200
+++ new/django-guardian-2.4.0/guardian/__init__.py      2021-05-24 
00:09:26.000000000 +0200
@@ -2,11 +2,13 @@
 Implementation of per object permissions for Django.
 """
 from . import checks
+import django
 
-default_app_config = 'guardian.apps.GuardianConfig'
+if django.VERSION < (3, 2):
+    default_app_config = 'guardian.apps.GuardianConfig'
 
 # PEP 396: The __version__ attribute's value SHOULD be a string.
-__version__ = '2.3.0'
+__version__ = '2.4.0'
 
 # Compatibility to eg. django-rest-framework
 VERSION = tuple(int(x) for x in __version__.split('.')[:3])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/apps.py 
new/django-guardian-2.4.0/guardian/apps.py
--- old/django-guardian-2.3.0/guardian/apps.py  2019-12-20 15:00:56.000000000 
+0100
+++ new/django-guardian-2.4.0/guardian/apps.py  2021-05-23 23:59:25.000000000 
+0200
@@ -5,6 +5,7 @@
 
 class GuardianConfig(AppConfig):
     name = 'guardian'
+    default_auto_field = 'django.db.models.AutoField'
 
     def ready(self):
         # Must patch Group here since generic
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/core.py 
new/django-guardian-2.4.0/guardian/core.py
--- old/django-guardian-2.3.0/guardian/core.py  2020-02-03 19:18:19.000000000 
+0100
+++ new/django-guardian-2.4.0/guardian/core.py  2021-05-23 23:59:25.000000000 
+0200
@@ -157,9 +157,9 @@
             if guardian_settings.AUTO_PREFETCH:
                 return []
             if self.user and self.user.is_superuser:
-                perms = list(chain(*Permission.objects
-                                   .filter(content_type=ctype)
-                                   .values_list("codename")))
+                perms = list(
+                    
Permission.objects.filter(content_type=ctype).values_list("codename", flat=True)
+                )
             elif self.user:
                 # Query user and group permissions separately and then combine
                 # the results to avoid a slow query
@@ -192,10 +192,9 @@
         pks, model, ctype = _get_pks_model_and_ctype(objects)
 
         if self.user and self.user.is_superuser:
-            perms = list(chain(
-                *Permission.objects
-                .filter(content_type=ctype)
-                .values_list("codename")))
+            perms = list(
+                
Permission.objects.filter(content_type=ctype).values_list("codename", flat=True)
+            )
 
             for pk in pks:
                 key = (ctype.id, force_str(pk))
@@ -245,9 +244,7 @@
             group_perms_qs = 
group_model.objects.filter(**group_filters).select_related('permission')
             perms = chain(user_perms_qs, group_perms_qs)
         else:
-            perms = chain(
-                
*(group_model.objects.filter(**group_filters).select_related('permission'),)
-            )
+            perms = 
group_model.objects.filter(**group_filters).select_related('permission')
 
         # initialize entry in '_obj_perms_cache' for all prefetched objects
         for obj in objects:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/mixins.py 
new/django-guardian-2.4.0/guardian/mixins.py
--- old/django-guardian-2.3.0/guardian/mixins.py        2019-12-20 
15:00:56.000000000 +0100
+++ new/django-guardian-2.4.0/guardian/mixins.py        2021-05-23 
23:59:25.000000000 +0200
@@ -126,6 +126,10 @@
          to ``self.get_permission_object()`` which return ``self.get_object()``
          or ``self.object`` by default.
 
+    ``PermissionRequiredMixin.any_perm``
+
+        *Default*: ``False``. if True, any of permission in sequence is 
accepted.
+
     """
     # default class view settings
     login_url = settings.LOGIN_URL
@@ -135,6 +139,7 @@
     return_404 = False
     raise_exception = False
     accept_global_perms = False
+    any_perm = False
 
     def get_required_permissions(self, request=None):
         """
@@ -178,7 +183,8 @@
                                     
redirect_field_name=self.redirect_field_name,
                                     return_403=self.return_403,
                                     return_404=self.return_404,
-                                    
accept_global_perms=self.accept_global_perms
+                                    
accept_global_perms=self.accept_global_perms,
+                                    any_perm=self.any_perm,
                                     )
         if forbidden:
             self.on_permission_check_fail(request, forbidden, obj=obj)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/shortcuts.py 
new/django-guardian-2.4.0/guardian/shortcuts.py
--- old/django-guardian-2.3.0/guardian/shortcuts.py     2020-06-08 
01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/guardian/shortcuts.py     2021-05-23 
23:59:25.000000000 +0200
@@ -162,17 +162,18 @@
     """
     user, group = get_identity(user_or_group)
     if obj is None:
-        try:
-            app_label, codename = perm.split('.', 1)
-        except ValueError:
-            raise ValueError("For global permissions, first argument must be 
in"
-                             " format: 'app_label.codename' (is %r)" % perm)
-        perm = Permission.objects.get(content_type__app_label=app_label,
-                                      codename=codename)
+        if not isinstance(perm, Permission):
+            try:
+                app_label, codename = perm.split('.', 1)
+            except ValueError:
+                raise ValueError("For global permissions, first argument must 
be in"
+                                 " format: 'app_label.codename' (is %r)" % 
perm)
+            perm = Permission.objects.get(content_type__app_label=app_label,
+                                          codename=codename)
         if user:
             user.user_permissions.remove(perm)
             return
-        elif group:
+        if group:
             group.permissions.remove(perm)
             return
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-guardian-2.3.0/guardian/testapp/tests/test_decorators.py 
new/django-guardian-2.4.0/guardian/testapp/tests/test_decorators.py
--- old/django-guardian-2.3.0/guardian/testapp/tests/test_decorators.py 
2020-06-08 01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/guardian/testapp/tests/test_decorators.py 
2021-05-23 23:59:25.000000000 +0200
@@ -1,3 +1,4 @@
+import django
 from django.conf import global_settings
 from django.contrib.auth import get_user_model
 from django.contrib.auth.models import Group, AnonymousUser
@@ -383,8 +384,12 @@
             pass
         response = dummy_view(request, project_name='foobar')
         self.assertTrue(isinstance(response, HttpResponseRedirect))
-        self.assertTrue(response._headers['location'][1].startswith(
-            '/foobar/'))
+        if django.VERSION >= (3, 2):
+            self.assertTrue(response.headers['location'].startswith(
+                '/foobar/'))
+        else:
+            self.assertTrue(response._headers['location'][1].startswith(
+                '/foobar/'))
 
     @override_settings(LOGIN_URL='django.contrib.auth.views.login')
     def test_redirection_class(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-guardian-2.3.0/guardian/testapp/tests/test_mixins.py 
new/django-guardian-2.4.0/guardian/testapp/tests/test_mixins.py
--- old/django-guardian-2.3.0/guardian/testapp/tests/test_mixins.py     
2020-06-08 01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/guardian/testapp/tests/test_mixins.py     
2021-05-23 23:59:25.000000000 +0200
@@ -212,3 +212,26 @@
 
         response = view(request)
         self.assertContains(response, b'foo-post-title')
+
+    def test_any_perm_parameter(self):
+        request = self.factory.get('/')
+        request.user = self.user
+        request.user.add_obj_perm('view_post', self.post)
+        self.assertIs(request.user.has_perm('view_post', self.post), True)
+        self.assertIs(request.user.has_perm('change_post', self.post), False)
+        # success way
+        view = TestView.as_view(
+            any_perm=True,
+            permission_required=['change_post', 'view_post'],
+            object=self.post,
+        )
+        with self.assertRaises(DatabaseRemovedError):
+            view(request)
+        # fail way
+        view = TestView.as_view(
+            any_perm=False,
+            permission_required=['change_post', 'view_post'],
+            object=self.post,
+        )
+        response = view(request)
+        self.assertEqual(response.status_code, 302)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-guardian-2.3.0/guardian/testapp/tests/test_shortcuts.py 
new/django-guardian-2.4.0/guardian/testapp/tests/test_shortcuts.py
--- old/django-guardian-2.3.0/guardian/testapp/tests/test_shortcuts.py  
2020-06-08 01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/guardian/testapp/tests/test_shortcuts.py  
2021-05-23 23:59:25.000000000 +0200
@@ -109,7 +109,9 @@
 
     def test_user_assign_perm_global(self):
         perm = assign_perm("contenttypes.change_contenttype", self.user)
+        assign_perm(self.get_permission("delete_contenttype"), self.group)
         self.assertTrue(self.user.has_perm("contenttypes.change_contenttype"))
+        self.assertTrue(self.user.has_perm("contenttypes.delete_contenttype"))
         self.assertTrue(isinstance(perm, Permission))
 
     def test_group_assign_perm_global(self):
@@ -160,7 +162,7 @@
         for obj in self.ctype_list:
             self.assertTrue(check.has_perm("add_contenttype", obj))
             self.assertTrue(check.has_perm("change_contenttype", obj))
-            self.assertTrue(check.has_perm("delete_contenttype", obj)) 
+            self.assertTrue(check.has_perm("delete_contenttype", obj))
 
 
 class MultipleIdentitiesOperationsTest(ObjectPermissionTestCase):
@@ -272,9 +274,13 @@
     def test_user_remove_perm_global(self):
         # assign perm first
         perm = "contenttypes.change_contenttype"
+        perm_obj = self.get_permission("delete_contenttype")
         assign_perm(perm, self.user)
+        assign_perm(perm_obj, self.user)
         remove_perm(perm, self.user)
+        remove_perm(perm_obj, self.user)
         self.assertFalse(self.user.has_perm(perm))
+        self.assertFalse(self.user.has_perm(perm_obj.codename))
 
     def test_group_remove_perm_global(self):
         # assign perm first
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/guardian/utils.py 
new/django-guardian-2.4.0/guardian/utils.py
--- old/django-guardian-2.3.0/guardian/utils.py 2019-12-20 15:00:56.000000000 
+0100
+++ new/django-guardian-2.4.0/guardian/utils.py 2021-05-23 23:59:25.000000000 
+0200
@@ -93,7 +93,8 @@
 
 def get_40x_or_None(request, perms, obj=None, login_url=None,
                     redirect_field_name=None, return_403=False,
-                    return_404=False, accept_global_perms=False):
+                    return_404=False, accept_global_perms=False,
+                    any_perm=False):
     login_url = login_url or settings.LOGIN_URL
     redirect_field_name = redirect_field_name or REDIRECT_FIELD_NAME
 
@@ -106,8 +107,12 @@
         has_permissions = all(request.user.has_perm(perm) for perm in perms)
     # if still no permission granted, try obj perms
     if not has_permissions:
-        has_permissions = all(request.user.has_perm(perm, obj)
-                              for perm in perms)
+        if any_perm:
+            has_permissions = any(request.user.has_perm(perm, obj)
+                                  for perm in perms)
+        else:
+            has_permissions = all(request.user.has_perm(perm, obj)
+                                  for perm in perms)
 
     if not has_permissions:
         if return_403:
@@ -180,7 +185,7 @@
 def get_obj_perms_model(obj, base_cls, generic_cls):
     """
     Return the matching object permission model for the obj class
-    Defaults to returning the generic object permission when 
+    Defaults to returning the generic object permission when
     no direct foreignkey is defined or obj is None
     """
     # Default to the generic object permission model
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/setup.cfg 
new/django-guardian-2.4.0/setup.cfg
--- old/django-guardian-2.3.0/setup.cfg 2020-06-08 01:52:28.000000000 +0200
+++ new/django-guardian-2.4.0/setup.cfg 2021-05-24 00:10:31.000000000 +0200
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 2.3.0
+current_version = 2.4.0
 
 [build_sphinx]
 source-dir = docs/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/setup.py 
new/django-guardian-2.4.0/setup.py
--- old/django-guardian-2.3.0/setup.py  2020-06-08 01:50:55.000000000 +0200
+++ new/django-guardian-2.4.0/setup.py  2021-05-24 00:09:26.000000000 +0200
@@ -3,7 +3,7 @@
 from extras import RunFlakesCommand
 
 
-version = '2.3.0'
+version = '2.4.0'
 
 readme_file = os.path.join(os.path.dirname(__file__), 'README.rst')
 with open(readme_file) as f:
@@ -35,16 +35,20 @@
                  'Framework :: Django',
                  'Framework :: Django :: 2.2',
                  'Framework :: Django :: 3.0',
+                 'Framework :: Django :: 3.1',
+                 'Framework :: Django :: 3.2',
                  'Intended Audience :: Developers',
                  'License :: OSI Approved :: BSD License',
                  'Operating System :: OS Independent',
                  'Programming Language :: Python',
                  'Topic :: Security',
+                 'Programming Language :: Python :: 3',
+                 'Programming Language :: Python :: 3 :: Only',
                  'Programming Language :: Python :: 3.5',
                  'Programming Language :: Python :: 3.6',
                  'Programming Language :: Python :: 3.7',
                  'Programming Language :: Python :: 3.8',
-                 'Programming Language :: Python :: 3 :: Only',
+                 'Programming Language :: Python :: 3.9',
                  ],
     test_suite='tests.main',
     cmdclass={'flakes': RunFlakesCommand},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-guardian-2.3.0/tox.ini 
new/django-guardian-2.4.0/tox.ini
--- old/django-guardian-2.3.0/tox.ini   2020-06-08 01:49:56.000000000 +0200
+++ new/django-guardian-2.4.0/tox.ini   2021-05-23 23:59:25.000000000 +0200
@@ -3,6 +3,9 @@
 envlist = # sort by django version, next by python version
     {core,example,docs}-py{35,36,37,38}-django22,
     {core,example,docs}-py{36,37,38}-django30,
+    {core,example,docs}-py{36,37,38,39}-django31,
+    {core,example,docs}-py{36,37,38,39}-django32,
+    {core,example,docs}-py{38,39}-djangomain,
 
 [testenv]
 passenv = DATABASE_URL
@@ -11,12 +14,16 @@
     py36: python3.6
     py37: python3.7
     py38: python3.8
+    py39: python3.9
 changedir =
     example: example_project
     docs: docs
 commands =
     django22: python {toxinidir}/manage.py makemigrations --check --dry-run
     django30: python {toxinidir}/manage.py makemigrations --check --dry-run
+    django31: python {toxinidir}/manage.py makemigrations --check --dry-run
+    django32: python {toxinidir}/manage.py makemigrations --check --dry-run
+    djangomain: python {toxinidir}/manage.py makemigrations --check --dry-run
     core: py.test --cov=guardian
     docs: sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
     example: python manage.py test
@@ -32,5 +39,8 @@
     docs: sphinx
     docs: sphinx_rtd_theme
     docs: setuptools_scm
-    django22: django>=2.2,<2.3
-    django30: django>=3.0,<3.1
+    django22: django~=2.2.17
+    django30: django~=3.0.11
+    django31: django~=3.1.3
+    django32: django~=3.2rc1
+    djangomain: https://github.com/django/django/archive/main.tar.gz

Reply via email to