Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-social-auth-app-django for
openSUSE:Factory checked in at 2021-08-16 10:09:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-social-auth-app-django (Old)
and /work/SRC/openSUSE:Factory/.python-social-auth-app-django.new.1899
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-social-auth-app-django"
Mon Aug 16 10:09:21 2021 rev:8 rq:911557 version:5.0.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-social-auth-app-django/python-social-auth-app-django.changes
2020-08-19 18:59:34.971934621 +0200
+++
/work/SRC/openSUSE:Factory/.python-social-auth-app-django.new.1899/python-social-auth-app-django.changes
2021-08-16 10:14:24.718893038 +0200
@@ -1,0 +2,10 @@
+Wed Aug 11 11:53:52 UTC 2021 - Mark??ta Machov?? <[email protected]>
+
+- Update to version 5.0.0
+ * Removed compat shims for obsolete Django versions
+ * Switch from deprecated django.conf.urls.url to django.urls.path
+ * Drop support for Python 2
+ * Django generic JSONField support
+ * Django 3.2+ compatibility
+
+-------------------------------------------------------------------
Old:
----
social-auth-app-django-4.0.0.tar.gz
New:
----
social-auth-app-django-5.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-social-auth-app-django.spec ++++++
--- /var/tmp/diff_new_pack.KN8GRL/_old 2021-08-16 10:14:25.106892541 +0200
+++ /var/tmp/diff_new_pack.KN8GRL/_new 2021-08-16 10:14:25.110892537 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-social-auth-app-django
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,23 +19,21 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-social-auth-app-django
-Version: 4.0.0
+Version: 5.0.0
Release: 0
Summary: Python Social Authentication, Django integration
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/python-social-auth/social-app-django
Source:
https://files.pythonhosted.org/packages/source/s/social-auth-app-django/social-auth-app-django-%{version}.tar.gz
-BuildRequires: %{python_module Django >= 2.1}
+BuildRequires: %{python_module Django >= 2.2}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module six}
-BuildRequires: %{python_module social-auth-core >= 3.3.0}
+BuildRequires: %{python_module social-auth-core >= 4.1.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-Django >= 2.1
-Requires: python-six
-Requires: python-social-auth-core >= 3.3.0
+Requires: python-Django >= 2.2
+Requires: python-social-auth-core >= 4.1.0
BuildArch: noarch
%python_subpackages
++++++ social-auth-app-django-4.0.0.tar.gz ->
social-auth-app-django-5.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/CHANGELOG.md
new/social-auth-app-django-5.0.0/CHANGELOG.md
--- old/social-auth-app-django-4.0.0/CHANGELOG.md 2020-06-21
06:52:10.000000000 +0200
+++ new/social-auth-app-django-5.0.0/CHANGELOG.md 2021-08-05
20:13:52.000000000 +0200
@@ -5,7 +5,19 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
-##
[4.0.0](https://github.com/python-social-auth/social-app-django/releases/tag/3.4.0)
- 2020-05-30
+##
[5.0.0](https://github.com/python-social-auth/social-app-django/releases/tag/5.0.0)
- 2021-08-05
+
+### Changed
+- Removed compat shims for obsolete Django versions
+- Switch from deprecated `django.conf.urls.url` to `django.urls.path`
+- Use query `.exists()` instead of `.count() > 0`
+- Added testing for Django 3.0
+- Drop support for Python 2
+- Django generic `JSONField` support, details documented
[here](https://python-social-auth.readthedocs.io/en/latest/configuration/django.html#json-field-support)
+- Django 3.2+ compatibility
+- Use `_default_manager` instead of `objects`
+
+##
[4.0.0](https://github.com/python-social-auth/social-app-django/releases/tag/4.0.0)
- 2020-06-20
### Changed
- Dropped support for older Django versions (1.8, 1.9, 1.10, 2.0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/PKG-INFO
new/social-auth-app-django-5.0.0/PKG-INFO
--- old/social-auth-app-django-4.0.0/PKG-INFO 2020-06-21 06:56:08.670946100
+0200
+++ new/social-auth-app-django-5.0.0/PKG-INFO 2021-08-05 20:14:03.747578100
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: social-auth-app-django
-Version: 4.0.0
+Version: 5.0.0
Summary: Python Social Authentication, Django integration.
Home-page: https://github.com/python-social-auth/social-app-django
Author: Matias Aguirre
@@ -8,9 +8,10 @@
License: BSD
Description: # Python Social Auth - Django
- [](https://travis-ci.org/python-social-auth/social-app-django)
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
+ 
+ 
[](https://badge.fury.io/py/social-auth-app-django)
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
Python Social Auth is an easy to setup social
authentication/registration
mechanism with support for several frameworks and auth providers.
@@ -67,6 +68,10 @@
Classifier: Intended Audience :: Developers
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Requires-Python: >=3.6
Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/README.md
new/social-auth-app-django-5.0.0/README.md
--- old/social-auth-app-django-4.0.0/README.md 2020-05-30 04:10:23.000000000
+0200
+++ new/social-auth-app-django-5.0.0/README.md 2021-08-05 20:13:52.000000000
+0200
@@ -1,8 +1,9 @@
# Python Social Auth - Django
-[](https://travis-ci.org/python-social-auth/social-app-django)
-[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
+
+
[](https://badge.fury.io/py/social-auth-app-django)
+[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
Python Social Auth is an easy to setup social authentication/registration
mechanism with support for several frameworks and auth providers.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/dev-requirements.txt
new/social-auth-app-django-5.0.0/dev-requirements.txt
--- old/social-auth-app-django-4.0.0/dev-requirements.txt 2020-02-09
06:08:05.000000000 +0100
+++ new/social-auth-app-django-5.0.0/dev-requirements.txt 2021-08-05
20:13:52.000000000 +0200
@@ -1,4 +1,3 @@
-mock==2.0.0
codecov==2.0.7
tox==2.7.0
-r requirements.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/manage.py
new/social-auth-app-django-5.0.0/manage.py
--- old/social-auth-app-django-4.0.0/manage.py 2020-02-09 06:08:05.000000000
+0100
+++ new/social-auth-app-django-5.0.0/manage.py 2021-08-05 20:13:52.000000000
+0200
@@ -1,6 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals, absolute_import
import os
import sys
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/requirements.txt
new/social-auth-app-django-5.0.0/requirements.txt
--- old/social-auth-app-django-4.0.0/requirements.txt 2020-05-30
04:55:07.000000000 +0200
+++ new/social-auth-app-django-5.0.0/requirements.txt 2021-08-05
20:13:52.000000000 +0200
@@ -1,2 +1 @@
-six
-social-auth-core >= 3.3.0
+social-auth-core >= 4.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/setup.py
new/social-auth-app-django-5.0.0/setup.py
--- old/social-auth-app-django-4.0.0/setup.py 2020-05-30 04:10:23.000000000
+0200
+++ new/social-auth-app-django-5.0.0/setup.py 2021-08-05 20:13:52.000000000
+0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Setup file for easy installation"""
import re
@@ -6,7 +5,7 @@
from setuptools import setup
-VERSION_RE = re.compile('__version__ = \'([\d\.]+)\'')
+VERSION_RE = re.compile(r'__version__ = \'([\d\.]+)\'')
def read_version():
@@ -23,6 +22,7 @@
def load_requirements():
return open(join(dirname(__file__), 'requirements.txt')).readlines()
+
setup(
name='social-auth-app-django',
version=read_version(),
@@ -40,6 +40,7 @@
],
long_description=long_description(),
long_description_content_type='text/markdown',
+ python_requires='>=3.6',
install_requires=load_requirements(),
classifiers=[
'Development Status :: 4 - Beta',
@@ -48,8 +49,11 @@
'Intended Audience :: Developers',
'Environment :: Web Environment',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3'
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
],
zip_safe=False
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/PKG-INFO
new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/PKG-INFO
--- old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/PKG-INFO
2020-06-21 06:56:08.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/PKG-INFO
2021-08-05 20:14:03.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: social-auth-app-django
-Version: 4.0.0
+Version: 5.0.0
Summary: Python Social Authentication, Django integration.
Home-page: https://github.com/python-social-auth/social-app-django
Author: Matias Aguirre
@@ -8,9 +8,10 @@
License: BSD
Description: # Python Social Auth - Django
- [](https://travis-ci.org/python-social-auth/social-app-django)
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
+ 
+ 
[](https://badge.fury.io/py/social-auth-app-django)
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=matiasaguirre%40gmail%2ecom&lc=US&item_name=Python%20Social%20Auth&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest)
Python Social Auth is an easy to setup social
authentication/registration
mechanism with support for several frameworks and auth providers.
@@ -67,6 +68,10 @@
Classifier: Intended Audience :: Developers
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Requires-Python: >=3.6
Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/SOURCES.txt
new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/SOURCES.txt
---
old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/SOURCES.txt
2020-06-21 06:56:08.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/SOURCES.txt
2021-08-05 20:14:03.000000000 +0200
@@ -15,7 +15,7 @@
social_auth_app_django.egg-info/top_level.txt
social_django/__init__.py
social_django/admin.py
-social_django/compat.py
+social_django/apps.py
social_django/config.py
social_django/context_processors.py
social_django/fields.py
@@ -42,7 +42,6 @@
social_django/migrations/0010_uid_db_index.py
social_django/migrations/__init__.py
tests/__init__.py
-tests/compat.py
tests/settings.py
tests/test_admin.py
tests/test_context_processors.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/requires.txt
new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/requires.txt
---
old/social-auth-app-django-4.0.0/social_auth_app_django.egg-info/requires.txt
2020-06-21 06:56:08.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_auth_app_django.egg-info/requires.txt
2021-08-05 20:14:03.000000000 +0200
@@ -1,2 +1 @@
-six
-social-auth-core>=3.3.0
+social-auth-core>=4.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/__init__.py
new/social-auth-app-django-5.0.0/social_django/__init__.py
--- old/social-auth-app-django-4.0.0/social_django/__init__.py 2020-06-21
06:52:06.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/__init__.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,6 +1,7 @@
-__version__ = '4.0.0'
+__version__ = '5.0.0'
+import django
from social_core.backends.base import BaseAuth
# django.contrib.auth.load_backend() will import and instanciate the
@@ -9,6 +10,7 @@
# BaseAuth.__init__ to ignore the mandatory strategy argument and load
# it.
+
def baseauth_init_workaround(original_init):
def fake_init(self, strategy=None, *args, **kwargs):
from .utils import load_strategy
@@ -20,4 +22,5 @@
BaseAuth.__init__ = baseauth_init_workaround(BaseAuth.__init__)
BaseAuth.__init_patched = True
-default_app_config = 'social_django.config.PythonSocialAuthConfig'
+if django.VERSION < (3, 2):
+ default_app_config = 'social_django.apps.PythonSocialAuthConfig'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/admin.py
new/social-auth-app-django-5.0.0/social_django/admin.py
--- old/social-auth-app-django-4.0.0/social_django/admin.py 2020-05-30
04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/admin.py 2021-08-05
20:13:52.000000000 +0200
@@ -22,12 +22,12 @@
if search_fields is None:
_User = UserSocialAuth.user_model()
username = getattr(_User, 'USERNAME_FIELD', None) or \
- hasattr(_User, 'username') and 'username' or \
- None
+ hasattr(_User, 'username') and 'username' or \
+ None
fieldnames = ('first_name', 'last_name', 'email', username)
all_names = self._get_all_field_names(_User._meta)
search_fields = [name for name in fieldnames
- if name and name in all_names]
+ if name and name in all_names]
return ['user__' + name for name in search_fields] + \
getattr(settings, setting_name('ADMIN_SEARCH_FIELDS'), [])
@@ -35,7 +35,7 @@
def _get_all_field_names(model):
names = chain.from_iterable(
(field.name, field.attname)
- if hasattr(field, 'attname') else (field.name,)
+ if hasattr(field, 'attname') else (field.name,)
for field in model.get_fields()
# For complete backwards compatibility, you may want to exclude
# GenericForeignKey from the results.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/apps.py
new/social-auth-app-django-5.0.0/social_django/apps.py
--- old/social-auth-app-django-4.0.0/social_django/apps.py 1970-01-01
01:00:00.000000000 +0100
+++ new/social-auth-app-django-5.0.0/social_django/apps.py 2021-08-05
20:13:52.000000000 +0200
@@ -0,0 +1,12 @@
+from django.apps import AppConfig
+
+
+class PythonSocialAuthConfig(AppConfig):
+ # Explicitly set default auto field type to avoid migrations in Django 3.2+
+ default_auto_field = 'django.db.models.AutoField'
+ # Full Python path to the application eg. 'django.contrib.admin'.
+ name = 'social_django'
+ # Last component of the Python path to the application eg. 'admin'.
+ label = 'social_django'
+ # Human-readable name for the application eg. "Admin".
+ verbose_name = 'Python Social Auth'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/compat.py
new/social-auth-app-django-5.0.0/social_django/compat.py
--- old/social-auth-app-django-4.0.0/social_django/compat.py 2020-02-09
06:08:05.000000000 +0100
+++ new/social-auth-app-django-5.0.0/social_django/compat.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-# coding=utf-8
-import six
-import django
-from django.db import models
-
-
-try:
- from django.urls import reverse
-except ImportError:
- from django.core.urlresolvers import reverse
-
-try:
- from django.utils.deprecation import MiddlewareMixin
-except ImportError:
- MiddlewareMixin = object
-
-
-def get_rel_model(field):
- if django.VERSION >= (1, 9):
- return field.remote_field.model
-
- user_model = field.rel.to
- if isinstance(user_model, six.string_types):
- app_label, model_name = user_model.split('.')
- user_model = models.get_model(app_label, model_name)
- return user_model
-
-
-def get_request_port(request):
- if django.VERSION >= (1, 9):
- return request.get_port()
-
- host_parts = request.get_host().partition(':')
- return host_parts[2] or request.META['SERVER_PORT']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/config.py
new/social-auth-app-django-5.0.0/social_django/config.py
--- old/social-auth-app-django-4.0.0/social_django/config.py 2020-02-09
06:08:05.000000000 +0100
+++ new/social-auth-app-django-5.0.0/social_django/config.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,10 +1,2 @@
-from django.apps import AppConfig
-
-
-class PythonSocialAuthConfig(AppConfig):
- # Full Python path to the application eg. 'django.contrib.admin'.
- name = 'social_django'
- # Last component of the Python path to the application eg. 'admin'.
- label = 'social_django'
- # Human-readable name for the application eg. "Admin".
- verbose_name = 'Python Social Auth'
+# For backward compatibility. You should use the configuration from apps module
+from .apps import PythonSocialAuthConfig # noqa: F401
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/context_processors.py
new/social-auth-app-django-5.0.0/social_django/context_processors.py
--- old/social-auth-app-django-4.0.0/social_django/context_processors.py
2020-05-30 04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/context_processors.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,7 @@
from django.contrib.auth import REDIRECT_FIELD_NAME
+from django.conf import settings
from django.utils.functional import SimpleLazyObject
-from django.utils.http import urlquote
+from urllib.parse import quote
try:
from django.utils.functional import empty as _empty
@@ -10,11 +11,12 @@
from social_core.backends.utils import user_backends_data
-from .utils import Storage, BACKENDS
+from .utils import Storage
class LazyDict(SimpleLazyObject):
"""Lazy dict initialization."""
+
def __getitem__(self, name):
if self._wrapped is empty:
self._setup()
@@ -30,17 +32,17 @@
"""Load Social Auth current user data to context under the key 'backends'.
Will return the output of social_core.backends.utils.user_backends_data."""
return {'backends': LazyDict(lambda: user_backends_data(request.user,
- BACKENDS,
+
settings.AUTHENTICATION_BACKENDS,
Storage))}
def login_redirect(request):
"""Load current redirect to context."""
value = request.method == 'POST' and \
- request.POST.get(REDIRECT_FIELD_NAME) or \
- request.GET.get(REDIRECT_FIELD_NAME)
+ request.POST.get(REDIRECT_FIELD_NAME) or \
+ request.GET.get(REDIRECT_FIELD_NAME)
if value:
- value = urlquote(value)
+ value = quote(value)
querystring = REDIRECT_FIELD_NAME + '=' + value
else:
querystring = ''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/fields.py
new/social-auth-app-django-5.0.0/social_django/fields.py
--- old/social-auth-app-django-4.0.0/social_django/fields.py 2020-05-30
04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/fields.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,15 +1,42 @@
import json
-import six
+import warnings
from django.core.exceptions import ValidationError
from django.conf import settings
from django.db import models
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
from social_core.utils import setting_name
-if getattr(settings, setting_name('POSTGRES_JSONFIELD'), False):
- from django.contrib.postgres.fields import JSONField as JSONFieldBase
+
+POSTGRES_JSONFIELD = getattr(settings, setting_name('POSTGRES_JSONFIELD'),
+ False)
+
+if POSTGRES_JSONFIELD:
+ warnings.warn(
+ 'SOCIAL_AUTH_POSTGRES_JSONFIELD has been renamed to '
+ 'SOCIAL_AUTH_JSONFIELD_ENABLED and will be removed in the next
release.'
+ )
+ JSONFIELD_ENABLED = True
+else:
+ JSONFIELD_ENABLED = getattr(settings, setting_name('JSONFIELD_ENABLED'),
+ False)
+
+if JSONFIELD_ENABLED:
+ JSONFIELD_CUSTOM = getattr(settings, setting_name('JSONFIELD_CUSTOM'),
None)
+
+ if JSONFIELD_CUSTOM is not None:
+ try:
+ from django.utils.module_loading import import_string
+ except ImportError:
+ from importlib import import_module as import_string
+ JSONFieldBase = import_string(JSONFIELD_CUSTOM)
+ else:
+ try:
+ from django.db.models import JSONField as JSONFieldBase
+ except ImportError:
+ from django.contrib.postgres.fields import \
+ JSONField as JSONFieldBase
else:
JSONFieldBase = models.TextField
@@ -21,7 +48,7 @@
def __init__(self, *args, **kwargs):
kwargs.setdefault('default', dict)
- super(JSONField, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def from_db_value(self, value, *args, **kwargs):
return self.to_python(value)
@@ -34,9 +61,9 @@
if self.blank and not value:
return {}
value = value or '{}'
- if isinstance(value, six.binary_type):
- value = six.text_type(value, 'utf-8')
- if isinstance(value, six.string_types):
+ if isinstance(value, bytes):
+ value = str(value, 'utf-8')
+ if isinstance(value, str):
try:
return json.loads(value)
except Exception as err:
@@ -47,8 +74,8 @@
def validate(self, value, model_instance):
"""Check value is a valid JSON string, raise ValidationError on
error."""
- if isinstance(value, six.string_types):
- super(JSONField, self).validate(value, model_instance)
+ if isinstance(value, str):
+ super().validate(value, model_instance)
try:
json.loads(value)
except Exception as err:
@@ -63,9 +90,9 @@
def value_to_string(self, obj):
"""Return value from object converted to string properly"""
- return force_text(self.value_from_object(obj))
+ return force_str(self.value_from_object(obj))
def value_from_object(self, obj):
"""Return value dumped to string."""
- orig_val = super(JSONField, self).value_from_object(obj)
+ orig_val = super().value_from_object(obj)
return self.get_prep_value(orig_val)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/management/commands/clearsocial.py
new/social-auth-app-django-5.0.0/social_django/management/commands/clearsocial.py
---
old/social-auth-app-django-4.0.0/social_django/management/commands/clearsocial.py
2020-02-09 06:08:05.000000000 +0100
+++
new/social-auth-app-django-5.0.0/social_django/management/commands/clearsocial.py
2021-08-05 20:13:52.000000000 +0200
@@ -10,7 +10,7 @@
help = 'removes old not used verification codes and partials'
def add_arguments(self, parser):
- super(Command, self).add_arguments(parser)
+ super().add_arguments(parser)
parser.add_argument(
'--age',
action='store',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/middleware.py
new/social-auth-app-django-5.0.0/social_django/middleware.py
--- old/social-auth-app-django-4.0.0/social_django/middleware.py
2020-05-30 04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/middleware.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,16 +1,13 @@
-# -*- coding: utf-8 -*-
-import six
-
from django.apps import apps
from django.conf import settings
from django.contrib import messages
from django.contrib.messages.api import MessageFailure
from django.shortcuts import redirect
-from django.utils.http import urlquote
+from django.utils.deprecation import MiddlewareMixin
+from urllib.parse import quote
from social_core.exceptions import SocialAuthBaseException
from social_core.utils import social_logger
-from .compat import MiddlewareMixin
class SocialAuthExceptionMiddleware(MiddlewareMixin):
@@ -44,8 +41,8 @@
except MessageFailure:
if url:
url += ('?' in url and '&' or '?') + \
-
'message={0}&backend={1}'.format(urlquote(message),
- backend_name)
+ 'message={}&backend={}'.format(quote(message),
+ backend_name)
else:
social_logger.error(message)
@@ -58,7 +55,7 @@
return strategy.setting('RAISE_EXCEPTIONS') or settings.DEBUG
def get_message(self, request, exception):
- return six.text_type(exception)
+ return str(exception)
def get_redirect_uri(self, request, exception):
strategy = getattr(request, 'social_strategy', None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0001_initial.py
new/social-auth-app-django-5.0.0/social_django/migrations/0001_initial.py
--- old/social-auth-app-django-4.0.0/social_django/migrations/0001_initial.py
2020-05-30 04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/migrations/0001_initial.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0002_add_related_name.py
new/social-auth-app-django-5.0.0/social_django/migrations/0002_add_related_name.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0002_add_related_name.py
2020-05-30 04:10:23.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0002_add_related_name.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0003_alter_email_max_length.py
new/social-auth-app-django-5.0.0/social_django/migrations/0003_alter_email_max_length.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0003_alter_email_max_length.py
2020-05-30 04:10:23.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0003_alter_email_max_length.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.conf import settings
from django.db import models, migrations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0004_auto_20160423_0400.py
new/social-auth-app-django-5.0.0/social_django/migrations/0004_auto_20160423_0400.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0004_auto_20160423_0400.py
2020-05-30 04:10:23.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0004_auto_20160423_0400.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,7 +1,4 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
+from django.db import migrations
from ..fields import JSONField
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0005_auto_20160727_2333.py
new/social-auth-app-django-5.0.0/social_django/migrations/0005_auto_20160727_2333.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0005_auto_20160727_2333.py
2020-05-30 04:10:23.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0005_auto_20160727_2333.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-28 02:33
-from __future__ import unicode_literals
from django.db import migrations
@@ -17,6 +15,6 @@
operations = [
migrations.AlterUniqueTogether(
name='association',
- unique_together=set([('server_url', 'handle')]),
+ unique_together={('server_url', 'handle')},
),
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0006_partial.py
new/social-auth-app-django-5.0.0/social_django/migrations/0006_partial.py
--- old/social-auth-app-django-4.0.0/social_django/migrations/0006_partial.py
2020-02-09 06:08:05.000000000 +0100
+++ new/social-auth-app-django-5.0.0/social_django/migrations/0006_partial.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-02 11:54
-from __future__ import unicode_literals
from django.db import migrations, models
import social_django.fields
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0007_code_timestamp.py
new/social-auth-app-django-5.0.0/social_django/migrations/0007_code_timestamp.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0007_code_timestamp.py
2020-02-09 06:08:05.000000000 +0100
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0007_code_timestamp.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-08 06:54
-from __future__ import unicode_literals
from django.db import migrations, models
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0008_partial_timestamp.py
new/social-auth-app-django-5.0.0/social_django/migrations/0008_partial_timestamp.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0008_partial_timestamp.py
2020-02-09 06:08:05.000000000 +0100
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0008_partial_timestamp.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-08 06:57
-from __future__ import unicode_literals
from django.db import migrations, models
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/migrations/0010_uid_db_index.py
new/social-auth-app-django-5.0.0/social_django/migrations/0010_uid_db_index.py
---
old/social-auth-app-django-4.0.0/social_django/migrations/0010_uid_db_index.py
2020-05-30 05:19:26.000000000 +0200
+++
new/social-auth-app-django-5.0.0/social_django/migrations/0010_uid_db_index.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.conf import settings
from django.db import models, migrations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/models.py
new/social-auth-app-django-5.0.0/social_django/models.py
--- old/social-auth-app-django-4.0.0/social_django/models.py 2020-05-30
05:19:26.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/models.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,23 +1,20 @@
"""Django ORM models for Social Auth"""
-import six
-
from django.db import models
from django.conf import settings
from django.db.utils import IntegrityError
from social_core.utils import setting_name
-from .compat import get_rel_model
from .storage import DjangoUserMixin, DjangoAssociationMixin, \
- DjangoNonceMixin, DjangoCodeMixin, \
- DjangoPartialMixin, BaseDjangoStorage
+ DjangoNonceMixin, DjangoCodeMixin, \
+ DjangoPartialMixin, BaseDjangoStorage
from .fields import JSONField
from .managers import UserSocialAuthManager
USER_MODEL = getattr(settings, setting_name('USER_MODEL'), None) or \
- getattr(settings, 'AUTH_USER_MODEL', None) or \
- 'auth.User'
+ getattr(settings, 'AUTH_USER_MODEL', None) or \
+ 'auth.User'
UID_LENGTH = getattr(settings, setting_name('UID_LENGTH'), 255)
EMAIL_LENGTH = getattr(settings, setting_name('EMAIL_LENGTH'), 254)
NONCE_SERVER_URL_LENGTH = getattr(
@@ -62,8 +59,7 @@
@classmethod
def user_model(cls):
- user_model = get_rel_model(field=cls._meta.get_field('user'))
- return user_model
+ return cls._meta.get_field('user').remote_field.model
class UserSocialAuth(AbstractUserSocialAuth):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/storage.py
new/social-auth-app-django-5.0.0/social_django/storage.py
--- old/social-auth-app-django-4.0.0/social_django/storage.py 2020-05-30
04:58:43.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/storage.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,7 +1,6 @@
"""Django ORM models for Social Auth"""
import base64
-import six
-import sys
+
from django.core.exceptions import FieldDoesNotExist
from django.db import transaction, router
from django.db.utils import IntegrityError
@@ -17,7 +16,7 @@
user.save()
def set_extra_data(self, extra_data=None):
- if super(DjangoUserMixin, self).set_extra_data(extra_data):
+ if super().set_extra_data(extra_data):
self.save()
@classmethod
@@ -32,7 +31,7 @@
valid_password = user.has_usable_password()
else:
valid_password = True
- return valid_password or qs.count() > 0
+ return valid_password or qs.exists()
@classmethod
def disconnect(cls, entry):
@@ -50,7 +49,7 @@
"""
if 'username' in kwargs:
kwargs[cls.username_field()] = kwargs.pop('username')
- return cls.user_model().objects.filter(*args, **kwargs).count() > 0
+ return cls.user_model()._default_manager.filter(*args,
**kwargs).exists()
@classmethod
def get_username(cls, user):
@@ -77,20 +76,17 @@
# stays undamaged by wrapping the create in an atomic.
using = router.db_for_write(cls.user_model())
with transaction.atomic(using=using):
- user = cls.user_model().objects.create_user(*args,
**kwargs)
+ user =
cls.user_model()._default_manager.create_user(*args, **kwargs)
else:
- user = cls.user_model().objects.create_user(*args, **kwargs)
- except IntegrityError:
- # User might have been created on a different thread, try and find
them.
- # If we don't, re-raise the IntegrityError.
- exc_info = sys.exc_info()
+ user = cls.user_model()._default_manager.create_user(*args,
**kwargs)
+ except IntegrityError as exc:
# If email comes in as None it won't get found in the get
if kwargs.get('email', True) is None:
kwargs['email'] = ''
try:
- user = cls.user_model().objects.get(*args, **kwargs)
+ user = cls.user_model()._default_manager.get(*args, **kwargs)
except cls.user_model().DoesNotExist:
- six.reraise(*exc_info)
+ raise exc
return user
@classmethod
@@ -98,7 +94,7 @@
if pk:
kwargs = {'pk': pk}
try:
- return cls.user_model().objects.get(**kwargs)
+ return cls.user_model()._default_manager.get(**kwargs)
except cls.user_model().DoesNotExist:
return None
@@ -106,11 +102,11 @@
def get_users_by_email(cls, email):
user_model = cls.user_model()
email_field = getattr(user_model, 'EMAIL_FIELD', 'email')
- return user_model.objects.filter(**{email_field + '__iexact': email})
+ return user_model._default_manager.filter(**{email_field + '__iexact':
email})
@classmethod
def get_social_auth(cls, provider, uid):
- if not isinstance(uid, six.string_types):
+ if not isinstance(uid, str):
uid = str(uid)
try:
return cls.objects.get(provider=provider, uid=uid)
@@ -130,7 +126,7 @@
@classmethod
def create_social_auth(cls, user, uid, provider):
- if not isinstance(uid, six.string_types):
+ if not isinstance(uid, str):
uid = str(uid)
if hasattr(transaction, 'atomic'):
# In Django versions that have an "atomic" transaction decorator /
context
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/social_django/strategy.py
new/social-auth-app-django-5.0.0/social_django/strategy.py
--- old/social-auth-app-django-4.0.0/social_django/strategy.py 2020-06-21
06:42:24.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/strategy.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,18 +1,16 @@
-# coding=utf-8
from django.conf import settings
-from django.http import HttpResponse, HttpRequest
+from django.http import HttpResponse
from django.db.models import Model
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import authenticate
from django.shortcuts import redirect, resolve_url
from django.template import TemplateDoesNotExist, loader, engines
from django.utils.crypto import get_random_string
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
from django.utils.functional import Promise
from django.utils.translation import get_language
from social_core.strategy import BaseStrategy, BaseTemplateStrategy
-from .compat import get_request_port
def render_template_string(request, html, context=None):
@@ -37,14 +35,14 @@
def __init__(self, storage, request=None, tpl=None):
self.request = request
self.session = request.session if request else {}
- super(DjangoStrategy, self).__init__(storage, tpl)
+ super().__init__(storage, tpl)
def get_setting(self, name):
value = getattr(settings, name)
# Force text on URL named settings that are instance of Promise
if name.endswith('_URL'):
if isinstance(value, Promise):
- value = force_text(value)
+ value = force_str(value)
value = resolve_url(value)
return value
@@ -74,7 +72,7 @@
def request_port(self):
"""Port in use for this request"""
- return get_request_port(request=self.request)
+ return self.request.get_port()
def request_get(self):
"""Request GET data"""
@@ -149,7 +147,7 @@
if isinstance(val, dict) and 'pk' in val and 'ctype' in val:
ctype = ContentType.objects.get_for_id(val['ctype'])
ModelClass = ctype.model_class()
- val = ModelClass.objects.get(pk=val['pk'])
+ val = ModelClass._default_manager.get(pk=val['pk'])
return val
def get_language(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/urls.py
new/social-auth-app-django-5.0.0/social_django/urls.py
--- old/social-auth-app-django-4.0.0/social_django/urls.py 2020-05-30
04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/urls.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,6 +1,6 @@
"""URLs module"""
from django.conf import settings
-from django.conf.urls import url
+from django.urls import path
from social_core.utils import setting_name
from . import views
@@ -12,13 +12,13 @@
urlpatterns = [
# authentication / association
- url(r'^login/(?P<backend>[^/]+){0}$'.format(extra), views.auth,
- name='begin'),
- url(r'^complete/(?P<backend>[^/]+){0}$'.format(extra), views.complete,
- name='complete'),
+ path(f'login/<str:backend>{extra}', views.auth,
+ name='begin'),
+ path(f'complete/<str:backend>{extra}', views.complete,
+ name='complete'),
# disconnection
- url(r'^disconnect/(?P<backend>[^/]+){0}$'.format(extra), views.disconnect,
- name='disconnect'),
- url(r'^disconnect/(?P<backend>[^/]+)/(?P<association_id>\d+){0}$'
- .format(extra), views.disconnect, name='disconnect_individual'),
+ path(f'disconnect/<str:backend>{extra}', views.disconnect,
+ name='disconnect'),
+ path(f'disconnect/<str:backend>/<int:association_id>{extra}',
+ views.disconnect, name='disconnect_individual'),
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/utils.py
new/social-auth-app-django-5.0.0/social_django/utils.py
--- old/social-auth-app-django-4.0.0/social_django/utils.py 2020-05-30
04:10:23.000000000 +0200
+++ new/social-auth-app-django-5.0.0/social_django/utils.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,16 +1,13 @@
-# coding=utf-8
from functools import wraps
from django.conf import settings
from django.http import Http404
+from django.urls import reverse
from social_core.utils import setting_name, module_member, get_strategy
from social_core.exceptions import MissingBackend
-from social_core.backends.utils import get_backend
-from .compat import reverse
-BACKENDS = settings.AUTHENTICATION_BACKENDS
STRATEGY = getattr(settings, setting_name('STRATEGY'),
'social_django.strategy.DjangoStrategy')
STORAGE = getattr(settings, setting_name('STORAGE'),
@@ -24,8 +21,7 @@
def load_backend(strategy, name, redirect_uri):
- Backend = get_backend(BACKENDS, name)
- return Backend(strategy, redirect_uri)
+ return strategy.get_backend(name, redirect_uri=redirect_uri)
def psa(redirect_uri=None, load_strategy=load_strategy):
@@ -43,7 +39,8 @@
try:
request.backend = load_backend(request.social_strategy,
- backend, uri)
+ backend,
+ redirect_uri=uri)
except MissingBackend:
raise Http404('Backend not found')
return func(request, backend, *args, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/social_django/views.py
new/social-auth-app-django-5.0.0/social_django/views.py
--- old/social-auth-app-django-4.0.0/social_django/views.py 2020-02-09
06:08:05.000000000 +0100
+++ new/social-auth-app-django-5.0.0/social_django/views.py 2021-08-05
20:13:52.000000000 +0200
@@ -18,14 +18,14 @@
@never_cache
-@psa('{0}:complete'.format(NAMESPACE))
+@psa(f'{NAMESPACE}:complete')
def auth(request, backend):
return do_auth(request.backend, redirect_name=REDIRECT_FIELD_NAME)
@never_cache
@csrf_exempt
-@psa('{0}:complete'.format(NAMESPACE))
+@psa(f'{NAMESPACE}:complete')
def complete(request, backend, *args, **kwargs):
"""Authentication complete view"""
return do_complete(request.backend, _do_login, user=request.user,
@@ -92,8 +92,7 @@
def _do_login(backend, user, social_user):
- user.backend = '{0}.{1}'.format(backend.__module__,
- backend.__class__.__name__)
+ user.backend = f'{backend.__module__}.{backend.__class__.__name__}'
# Get these details early to avoid any issues involved in the
# session switch that happens when we call login().
enable_session_expiration = backend.setting('SESSION_EXPIRATION', False)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/compat.py
new/social-auth-app-django-5.0.0/tests/compat.py
--- old/social-auth-app-django-4.0.0/tests/compat.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/compat.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-# coding=utf-8
-import django
-from django.conf.urls import include
-from django.contrib import admin
-
-if django.VERSION < (1, 9):
- admin_urls = include(admin.site.urls)
- base_url = 'http://testserver'
-else:
- admin_urls = admin.site.urls
- base_url = ''
-
-if django.VERSION < (1, 10):
- username_max_length = 30
-else:
- username_max_length = 150
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/settings.py
new/social-auth-app-django-5.0.0/tests/settings.py
--- old/social-auth-app-django-4.0.0/tests/settings.py 2020-06-21
06:42:24.000000000 +0200
+++ new/social-auth-app-django-5.0.0/tests/settings.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals, absolute_import
-
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -50,6 +47,7 @@
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
+ 'django.template.context_processors.request',
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/test_admin.py
new/social-auth-app-django-5.0.0/tests/test_admin.py
--- old/social-auth-app-django-4.0.0/tests/test_admin.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/test_admin.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,9 +1,6 @@
-# -*- coding: utf-8
-from __future__ import unicode_literals, absolute_import
-
from django.contrib.auth import get_user_model
from django.test import TestCase
-from social_django.compat import reverse
+from django.urls import reverse
from social_django.models import UserSocialAuth
@@ -11,7 +8,7 @@
@classmethod
def setUpTestData(cls):
User = get_user_model()
- User.objects.create_superuser(
+ User._default_manager.create_superuser(
username='admin', email='[email protected]', first_name='Admin',
password='super-duper-test'
)
@@ -26,5 +23,5 @@
"""The App name in the admin index page"""
self.client.login(username='admin', password='super-duper-test')
meta = UserSocialAuth._meta
- url_name = 'admin:%s_%s_changelist' % (meta.app_label, meta.model_name)
+ url_name = f'admin:{meta.app_label}_{meta.model_name}_changelist'
self.client.get(reverse(url_name))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/tests/test_context_processors.py
new/social-auth-app-django-5.0.0/tests/test_context_processors.py
--- old/social-auth-app-django-4.0.0/tests/test_context_processors.py
2020-02-09 06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/test_context_processors.py
2021-08-05 20:13:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from django.test import TestCase, RequestFactory, override_settings
from social_django.context_processors import login_redirect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/social-auth-app-django-4.0.0/tests/test_middleware.py
new/social-auth-app-django-5.0.0/tests/test_middleware.py
--- old/social-auth-app-django-4.0.0/tests/test_middleware.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/test_middleware.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,22 +1,20 @@
-# coding=utf-8
import logging
-import mock
+from unittest import mock
from django.contrib.messages import MessageFailure
from django.http import HttpResponseRedirect
from django.test import TestCase, override_settings
+from django.urls import reverse
from social_core.exceptions import AuthCanceled
-from social_django.compat import reverse
-from .compat import base_url
class MockAuthCanceled(AuthCanceled):
def __init__(self, *args, **kwargs):
if not args:
kwargs.setdefault('backend', None)
- super(MockAuthCanceled, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
@mock.patch('social_core.backends.base.BaseAuth.request',
@@ -47,13 +45,14 @@
def test_login_error_url(self, mocked):
response = self.client.get(self.complete_url)
self.assertTrue(isinstance(response, HttpResponseRedirect))
- self.assertEqual(response.url, base_url + '/')
+ self.assertEqual(response.url, '/')
@override_settings(SOCIAL_AUTH_LOGIN_ERROR_URL='/')
@mock.patch('django.contrib.messages.error', side_effect=MessageFailure)
def test_message_failure(self, mocked_request, mocked_error):
response = self.client.get(self.complete_url)
self.assertTrue(isinstance(response, HttpResponseRedirect))
- self.assertEqual(response.url, base_url +
- '/?message=Authentication%20process%20canceled'
- '&backend=facebook')
+ self.assertEqual(
+ response.url,
+ '/?message=Authentication%20process%20canceled&backend=facebook'
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/test_models.py
new/social-auth-app-django-5.0.0/tests/test_models.py
--- old/social-auth-app-django-4.0.0/tests/test_models.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/test_models.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,9 +1,6 @@
-# -*- coding: utf-8
-from __future__ import unicode_literals, absolute_import
-
from datetime import timedelta
-import mock
+from unittest import mock
from django.contrib.auth import get_user_model
from django.core.management import call_command
from django.db import IntegrityError
@@ -11,21 +8,20 @@
from social_django.models import AbstractUserSocialAuth, Association, Code, \
DjangoStorage, Nonce, Partial, UserSocialAuth
-from .compat import username_max_length
class TestSocialAuthUser(TestCase):
def test_user_relationship_none(self):
"""Accessing User.social_user outside of the pipeline doesn't work"""
User = get_user_model()
- user = User.objects.create_user(username="randomtester")
+ user = User._default_manager.create_user(username="randomtester")
with self.assertRaises(AttributeError):
user.social_user
def test_user_existing_relationship(self):
"""Accessing User.social_user outside of the pipeline doesn't work"""
User = get_user_model()
- user = User.objects.create_user(username="randomtester")
+ user = User._default_manager.create_user(username="randomtester")
UserSocialAuth.objects.create(user=user,
provider='my-provider',
uid='1234')
@@ -34,7 +30,7 @@
def test_get_social_auth(self):
User = get_user_model()
- user = User.objects.create_user(username="randomtester")
+ user = User._default_manager.create_user(username="randomtester")
user_social = UserSocialAuth.objects.create(user=user,
provider='my-provider',
uid='1234')
@@ -66,7 +62,7 @@
class TestUserSocialAuth(TestCase):
def setUp(self):
self.user_model = get_user_model()
- self.user = self.user_model.objects.create_user(
+ self.user = self.user_model._default_manager.create_user(
username='randomtester', email='[email protected]')
self.usa = UserSocialAuth.objects.create(
user=self.user, provider='my-provider', uid='1234')
@@ -74,7 +70,7 @@
def test_changed(self):
self.user.email = eml = '[email protected]'
UserSocialAuth.changed(user=self.user)
- db_eml = self.user_model.objects.get(username=self.user.username).email
+ db_eml =
self.user_model._default_manager.get(username=self.user.username).email
self.assertEqual(db_eml, eml)
def test_set_extra_data(self):
@@ -121,7 +117,7 @@
@mock.patch('social_django.storage.transaction', spec=[])
def test_create_user_without_transaction_atomic(self, *args):
UserSocialAuth.create_user(username='test')
- self.assertTrue(self.user_model.objects.filter(
+ self.assertTrue(self.user_model._default_manager.filter(
username='test').exists())
def test_get_user(self):
@@ -169,8 +165,7 @@
user=self.user, provider=self.usa.provider, uid=self.usa.uid)
def test_username_max_length(self):
- self.assertEqual(UserSocialAuth.username_max_length(),
- username_max_length)
+ self.assertEqual(UserSocialAuth.username_max_length(), 150)
class TestNonce(TestCase):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/test_strategy.py
new/social-auth-app-django-5.0.0/tests/test_strategy.py
--- old/social-auth-app-django-4.0.0/tests/test_strategy.py 2020-06-21
06:42:24.000000000 +0200
+++ new/social-auth-app-django-5.0.0/tests/test_strategy.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,14 +1,11 @@
-# coding=utf-8
-from __future__ import unicode_literals, absolute_import
-
-import mock
+from unittest import mock
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.middleware import SessionMiddleware
from django.http import QueryDict, HttpResponse
from django.test import TestCase, RequestFactory
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import gettext_lazy
from social_django.utils import load_strategy, load_backend
@@ -17,7 +14,7 @@
def setUp(self):
self.request_factory = RequestFactory()
self.request = self.request_factory.get('/', data={'x': '1'})
- SessionMiddleware().process_request(self.request)
+ SessionMiddleware(lambda: None).process_request(self.request)
self.strategy = load_strategy(request=self.request)
def test_request_methods(self):
@@ -38,7 +35,7 @@
def test_settings(self):
with self.settings(LOGIN_ERROR_URL='/'):
self.assertEqual(self.strategy.get_setting('LOGIN_ERROR_URL'), '/')
- with self.settings(LOGIN_ERROR_URL=ugettext_lazy('/')):
+ with self.settings(LOGIN_ERROR_URL=gettext_lazy('/')):
self.assertEqual(self.strategy.get_setting('LOGIN_ERROR_URL'), '/')
def test_session_methods(self):
@@ -54,7 +51,7 @@
def test_session_value(self):
user_model = get_user_model()
- user = user_model.objects.create_user(username="test")
+ user = user_model._default_manager.create_user(username="test")
ctype = ContentType.objects.get_for_model(user_model)
val = self.strategy.to_session_value(val=user)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/test_views.py
new/social-auth-app-django-5.0.0/tests/test_views.py
--- old/social-auth-app-django-4.0.0/tests/test_views.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/test_views.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,14 +1,12 @@
-# -*- coding: utf-8 -*-
-import mock
+from unittest import mock
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AbstractBaseUser
from django.test import TestCase, override_settings
+from django.urls import reverse
-from social_django.compat import reverse
from social_django.models import UserSocialAuth
from social_django.views import get_session_timeout
-from .compat import base_url
@override_settings(SOCIAL_AUTH_FACEBOOK_KEY='1',
@@ -36,12 +34,12 @@
'.set_expiry', side_effect=[OverflowError, None]):
response = self.client.get(url)
self.assertEqual(response.status_code, 302)
- self.assertEqual(response.url, base_url + '/accounts/profile/')
+ self.assertEqual(response.url, '/accounts/profile/')
@mock.patch('social_core.backends.base.BaseAuth.request')
def test_disconnect(self, mock_request):
user_model = get_user_model()
- user = user_model.objects.create_user(username='test', password='pwd')
+ user = user_model._default_manager.create_user(username='test',
password='pwd')
UserSocialAuth.objects.create(user=user, provider='facebook')
self.client.login(username='test', password='pwd')
@@ -68,11 +66,11 @@
def setUp(self):
self.social_user = mock.MagicMock()
self.social_user.expiration_datetime.return_value = None
- super(TestGetSessionTimeout, self).setUp()
+ super().setUp()
def set_user_expiration(self, seconds):
self.social_user.expiration_datetime.return_value = mock.MagicMock(
- total_seconds = mock.MagicMock(return_value=seconds)
+ total_seconds=mock.MagicMock(return_value=seconds)
)
def test_expiration_disabled_no_max(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/social-auth-app-django-4.0.0/tests/urls.py
new/social-auth-app-django-5.0.0/tests/urls.py
--- old/social-auth-app-django-4.0.0/tests/urls.py 2020-02-09
06:08:08.000000000 +0100
+++ new/social-auth-app-django-5.0.0/tests/urls.py 2021-08-05
20:13:52.000000000 +0200
@@ -1,9 +1,8 @@
-# -*- coding: utf-8
-from django.conf.urls import url, include
-from .compat import admin_urls
+from django.urls import include, path
+from django.contrib import admin
urlpatterns = [
- url(r'^admin/', admin_urls),
- url(r'^', include('social_django.urls', namespace='social')),
+ path('admin/', admin.site.urls),
+ path('', include('social_django.urls', namespace='social')),
]