Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-Shutik committed May 13, 2019
2 parents 6f2dc73 + f70cb3d commit 07d395f
Show file tree
Hide file tree
Showing 56 changed files with 524 additions and 115 deletions.
File renamed without changes.
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# https://travis-ci.org/pennersr/django-allauth
sudo: false
dist: xenial
language: python

python: "3.6"

env:
matrix:
- TOXENV=py27-django111
- TOXENV=py34-django111
- TOXENV=py35-django111
- TOXENV=py36-django111
- TOXENV=py34-django20
- TOXENV=py35-django20
- TOXENV=py36-django20
- TOXENV=py35-django21
Expand All @@ -33,6 +31,13 @@ matrix:
env: TOXENV=py35-django21
- python: "3.5"
env: TOXENV=py35-django22

- python: "3.4"
env: TOXENV=py34-django111
dist: trusty
- python: "3.4"
env: TOXENV=py34-django20
dist: trusty
exclude:
- python: "3.6"
env: TOXENV=py35-django111
Expand Down
7 changes: 6 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Fred Palmer
Fábio Santos
George Whewell
Griffith Rees
Guilhem Saurel
Guillaume Vincent
Guoyu Hao
Hatem Nassrat
Expand All @@ -58,7 +59,9 @@ James Thompson
Jannis Leidel
Jannis Vajen
Jeff Triplett
Jeremy Satterfield
Jerome Leclanche
Jesse Gerard Brands
Jiyoon Ha
Joe Vanderstelt
John Bazik
Expand Down Expand Up @@ -105,6 +108,7 @@ Roberto Novaes
Rod Xavier Bondoc
Roman Tomjak
Roumen Antonov
Ryan Jarvis
Ryan Verner
Sam Solomon
Sanghyeok Lee
Expand All @@ -118,10 +122,11 @@ Tomas Babej
Tomas Marcik
Tuk Bredsdorff
Udi Oron
Victor Semionov
Volodymyr Yatsyk
Vuong Nguyen
Wendy Edwards
Will Ross
William Li
Yaroslav Muravsky
Yuri Kriachko
Yuri Kriachko
16 changes: 16 additions & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
0.39.2 (unreleased)
*******************

Note worthy changes
-------------------

- The ``instagram`` provider now extracts the user's full name.
- New provider: NextCloud (OAuth2)


0.39.1 (2019-02-28)
*******************

Expand All @@ -7,6 +17,12 @@ Note worthy changes
- The ``linkedin_oauth2`` provider now gracefully deals with old V1
data that might still be present in ``SocialAccount.extra_data``.

Backwards incompatible changes
------------------------------

- The ``globus`` provider's ``extract_uid`` now uses the openid
required field ``sub`` instead of the ``create_time`` field.


0.39.0 (2019-02-26)
*******************
Expand Down
16 changes: 8 additions & 8 deletions allauth/account/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from . import app_settings
from allauth.compat import force_str, ugettext_lazy as _

from ..utils import (
build_absolute_uri,
email_address_exists,
generate_unique_username,
get_user_model,
import_attribute,
)
from . import app_settings


class DefaultAccountAdapter(object):
Expand Down Expand Up @@ -85,7 +85,7 @@ def format_email_subject(self, subject):
if prefix is None:
site = get_current_site(self.request)
prefix = "[{name}] ".format(name=site.name)
return prefix + force_text(subject)
return prefix + force_str(subject)

def get_from_email(self):
"""
Expand Down Expand Up @@ -353,15 +353,15 @@ def ajax_response_form(self, form):
}
for field in form:
field_spec = {
'label': force_text(field.label),
'label': force_str(field.label),
'value': field.value(),
'help_text': force_text(field.help_text),
'help_text': force_str(field.help_text),
'errors': [
force_text(e) for e in field.errors
force_str(e) for e in field.errors
],
'widget': {
'attrs': {
k: force_text(v)
k: force_str(v)
for k, v in field.field.widget.attrs.items()
}
}
Expand Down
3 changes: 2 additions & 1 deletion allauth/account/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _

from allauth.compat import ugettext_lazy as _


class AccountConfig(AppConfig):
Expand Down
2 changes: 1 addition & 1 deletion allauth/account/auth_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.contrib.auth.backends import ModelBackend

from . import app_settings
from ..utils import get_user_model
from . import app_settings
from .app_settings import AuthenticationMethod
from .utils import filter_users_by_email, filter_users_by_username

Expand Down
6 changes: 4 additions & 2 deletions allauth/account/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
from django.contrib.sites.shortcuts import get_current_site
from django.core import exceptions, validators
from django.urls import reverse
from django.utils.translation import pgettext, ugettext, ugettext_lazy as _
from django.utils.translation import pgettext

from allauth.compat import ugettext, ugettext_lazy as _

from . import app_settings
from ..utils import (
build_absolute_uri,
get_username_max_length,
set_form_field_order,
)
from . import app_settings
from .adapter import get_adapter
from .app_settings import AuthenticationMethod
from .models import EmailAddress
Expand Down
6 changes: 3 additions & 3 deletions allauth/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from django.db import models, transaction
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from . import app_settings, signals
from allauth.compat import python_2_unicode_compatible, ugettext_lazy as _

from .. import app_settings as allauth_app_settings
from . import app_settings, signals
from .adapter import get_adapter
from .managers import EmailAddressManager, EmailConfirmationManager
from .utils import user_email
Expand Down
8 changes: 4 additions & 4 deletions allauth/account/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,16 @@ def _logout_view(self, method):
return c, getattr(c, method)(reverse('account_logout'))

@override_settings(ACCOUNT_EMAIL_VERIFICATION=app_settings
.EmailVerificationMethod.OPTIONAL)
.EmailVerificationMethod.OPTIONAL,
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE=False)
def test_optional_email_verification(self):
c = Client()
# Signup
c.get(reverse('account_signup'))
resp = c.post(reverse('account_signup'),
{'username': 'johndoe',
'email': '[email protected]',
'password1': 'johndoe',
'password2': 'johndoe'})
'password1': 'johndoe'})
# Logged in
self.assertRedirects(resp,
settings.LOGIN_REDIRECT_URL,
Expand Down Expand Up @@ -990,7 +990,7 @@ class CustomSignupFormTests(TestCase):

@override_settings(
ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE=True,
ACCOUNT_SIGNUP_PASSOWRD_ENTER_TWICE=True)
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE=True)
def test_custom_form_field_order(self):

expected_field_order = [
Expand Down
8 changes: 3 additions & 5 deletions allauth/account/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@
from django.db import models
from django.db.models import Q
from django.http import HttpResponseRedirect
from django.utils import six
from django.utils.encoding import force_text
from django.utils.http import urlencode
from django.utils.timezone import now

from allauth.compat import base36_to_int, int_to_base36
from allauth.compat import base36_to_int, force_str, int_to_base36, six

from . import app_settings, signals
from ..exceptions import ImmediateHttpResponse
from ..utils import (
get_request_param,
get_user_model,
import_callable,
valid_email_or_none,
)
from . import app_settings, signals
from .adapter import get_adapter
from .app_settings import EmailVerificationMethod

Expand Down Expand Up @@ -67,7 +65,7 @@ def default_user_display(user):
if app_settings.USER_MODEL_USERNAME_FIELD:
return getattr(user, app_settings.USER_MODEL_USERNAME_FIELD)
else:
return force_text(user)
return force_str(user)


def user_display(user):
Expand Down
2 changes: 1 addition & 1 deletion allauth/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from django.views.generic.base import TemplateResponseMixin, TemplateView, View
from django.views.generic.edit import FormView

from . import app_settings, signals
from ..exceptions import ImmediateHttpResponse
from ..utils import get_form_class, get_request_param
from . import app_settings, signals
from .adapter import get_adapter
from .forms import (
AddEmailForm,
Expand Down
36 changes: 35 additions & 1 deletion allauth/compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
from django.utils import six
try:
from django.utils.six.moves.urllib.parse import urlsplit
except ImportError:
from urllib.parse import urlsplit # noqa

try:
from django.utils import six
except ImportError:
class six:
PY3 = True
PY2 = False
integer_types = (int,)
string_types = (str,)


try:
Expand All @@ -11,6 +23,20 @@
except ImportError:
from urlparse import parse_qsl, parse_qs, urlparse, urlunparse, urljoin # noqa

try:
from django.utils.encoding import python_2_unicode_compatible
except ImportError:
def python_2_unicode_compatible(c):
return c

if six.PY2:
from django.utils.encoding import force_text as force_str
else:
try:
from django.utils.encoding import force_str
except ImportError:
from django.utils.encoding import force_text as force_str # noqa


def int_to_base36(i):
"""
Expand Down Expand Up @@ -43,3 +69,11 @@ def base36_to_int(s):
from django.utils.http import base36_to_int
value = base36_to_int(s)
return value


if six.PY3:
from django.utils.translation import gettext as ugettext # noqa
from django.utils.translation import gettext_lazy as ugettext_lazy # noqa
else:
from django.utils.translation import ugettext # noqa
from django.utils.translation import ugettext_lazy # noqa
2 changes: 1 addition & 1 deletion allauth/locale/no/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ msgid ""
msgstr ""
"Vennligst logg in med en\n"
"av dine eksisterende tredjeparts kontoer. Eller, <a href=\"%(signup_url)s"
"\">registrerdeg</a>\n"
"\">registrer deg</a>\n"
"for en %(site_name)s konto og logg inn under:"

#: templates/account/login.html:25
Expand Down
2 changes: 1 addition & 1 deletion allauth/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ msgstr ""

#: account/adapter.py:51
msgid "A user is already registered with this e-mail address."
msgstr "Um usuário já foi registado com este endereço de e-mail."
msgstr "Um usuário já foi registrado com este endereço de e-mail."

#: account/adapter.py:294
#, python-brace-format
Expand Down
5 changes: 3 additions & 2 deletions allauth/socialaccount/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from django.core.exceptions import ValidationError
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _

from . import app_settings
from allauth.compat import ugettext_lazy as _

from ..account import app_settings as account_settings
from ..account.adapter import get_adapter as get_account_adapter
from ..account.app_settings import EmailVerificationMethod
Expand All @@ -17,6 +17,7 @@
serialize_instance,
valid_email_or_none,
)
from . import app_settings


class DefaultSocialAccountAdapter(object):
Expand Down
3 changes: 2 additions & 1 deletion allauth/socialaccount/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _

from allauth.compat import ugettext_lazy as _


class SocialAccountConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion allauth/socialaccount/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import django
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import six

from allauth.compat import six


class JSONField(models.TextField):
Expand Down
Loading

0 comments on commit 07d395f

Please sign in to comment.