misc: remove deprecated py2-compatibility decorator (#45228)

This commit is contained in:
Paul Marillonnet 2020-07-20 16:02:10 +02:00 committed by Frédéric Péters
parent 00366bd061
commit 5db2ca57e0
10 changed files with 1 additions and 31 deletions

View File

@ -43,7 +43,6 @@ from authentic2.decorators import GlobalCache
from . import managers, fields, app_settings
@six.python_2_unicode_compatible
class OrganizationalUnit(OrganizationalUnitAbstractBase):
RESET_LINK_POLICY = 0
@ -373,7 +372,6 @@ Role._meta.natural_key = [
]
@six.python_2_unicode_compatible
class RoleParenting(RoleParentingAbstractBase):
class Meta(RoleParentingAbstractBase.Meta):
verbose_name = _('role parenting relation')

View File

@ -131,7 +131,6 @@ class IsVerifiedDescriptor(object):
return IsVerified(obj)
@six.python_2_unicode_compatible
class User(AbstractBaseUser, PermissionMixin):
"""
An abstract base class implementing a fully featured User model with
@ -367,7 +366,6 @@ class User(AbstractBaseUser, PermissionMixin):
self.save(update_fields=['email', 'email_verified', 'is_active', 'deleted'])
@six.python_2_unicode_compatible
class DeletedUser(models.Model):
deleted = models.DateTimeField(
verbose_name=_('Deletion date'))

View File

@ -47,7 +47,6 @@ from . import natural_key as unused_natural_key # noqa: F401
from .utils import ServiceAccessDenied
@six.python_2_unicode_compatible
class UserExternalId(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
@ -75,7 +74,6 @@ class UserExternalId(models.Model):
]
@six.python_2_unicode_compatible
class AuthenticationEvent(models.Model):
'''Record authentication events whatever the source'''
when = models.DateTimeField(auto_now=True, verbose_name=_('when'))
@ -135,7 +133,6 @@ class LogoutUrl(LogoutUrlAbstract):
verbose_name_plural = _('logout URL')
@six.python_2_unicode_compatible
class Attribute(models.Model):
label = models.CharField(verbose_name=_('label'), max_length=63, unique=True)
description = models.TextField(verbose_name=_('description'), blank=True)
@ -345,7 +342,6 @@ class AttributeValue(models.Model):
)
@six.python_2_unicode_compatible
class PasswordReset(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
@ -366,7 +362,6 @@ class PasswordReset(models.Model):
return six.text_type(self.user)
@six.python_2_unicode_compatible
class Service(models.Model):
name = models.CharField(
verbose_name=_('name'),

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.db import models
from django.utils import timezone, six
from django.utils import timezone
__all__ = ('Nonce',)
@ -28,7 +28,6 @@ class NonceManager(models.Manager):
self.filter(not_on_or_after__lt=now).delete()
@six.python_2_unicode_compatible
class Nonce(models.Model):
value = models.CharField(max_length=_NONCE_LENGTH_CONSTANT)
context = models.CharField(max_length=_NONCE_LENGTH_CONSTANT, blank=True, null=True)

View File

@ -199,7 +199,6 @@ AUTHSAML2_UNAUTH_TRANSIENT = (
)
@six.python_2_unicode_compatible
class SPOptionsIdPPolicy(models.Model):
'''
Policies configured as a SAML2 identity provider.
@ -281,7 +280,6 @@ class SPOptionsIdPPolicy(models.Model):
return self.name
@six.python_2_unicode_compatible
class SAMLAttribute(models.Model):
ATTRIBUTE_NAME_FORMATS = (
('basic', 'Basic'),
@ -364,7 +362,6 @@ class SAMLAttribute(models.Model):
)
@six.python_2_unicode_compatible
class LibertyProvider(Service):
entity_id = models.URLField(max_length=256, unique=True, verbose_name=_('Entity ID'))
entity_id_sha1 = models.CharField(max_length=40, blank=True, verbose_name=_('Entity ID SHA1'))
@ -443,7 +440,6 @@ def get_all_custom_or_default(instance, name):
# TODO: The IdP must look to the preferred binding order for sso in the SP metadata (AssertionConsumerService)
# expect if the protocol for response is defined in the request (ProtocolBinding attribute)
@six.python_2_unicode_compatible
class LibertyServiceProvider(models.Model):
liberty_provider = models.OneToOneField(
LibertyProvider,
@ -531,7 +527,6 @@ def nameid2kwargs(name_id):
federation_delete = managers.federation_delete
@six.python_2_unicode_compatible
class LibertyFederation(models.Model):
"""Store a federation, i.e. an identifier shared with another provider, be
it IdP or SP"""
@ -593,7 +588,6 @@ class LibertyFederation(models.Model):
return self.name_id_content
@six.python_2_unicode_compatible
class LibertySession(models.Model):
"""Store the link between a Django session and a SAML session"""
django_session_key = models.CharField(max_length=128)
@ -648,7 +642,6 @@ class LibertySession(models.Model):
verbose_name_plural = _("SAML sessions")
@six.python_2_unicode_compatible
class KeyValue(models.Model):
key = models.CharField(max_length=128, primary_key=True)
value = PickledObjectField()

View File

@ -18,7 +18,6 @@ import uuid
import json
from django.db import models
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.core.exceptions import ValidationError
@ -40,7 +39,6 @@ def validate_jwkset(data):
raise ValidationError(_('Invalid JWKSet: %s') % e)
@six.python_2_unicode_compatible
class OIDCProvider(models.Model):
STRATEGY_CREATE = 'create'
STRATEGY_FIND_UUID = 'find-uuid'
@ -181,7 +179,6 @@ class OIDCProvider(models.Model):
return '<OIDCProvider %r>' % self.issuer
@six.python_2_unicode_compatible
class OIDCClaimMapping(models.Model):
NOT_VERIFIED = 0
VERIFIED_CLAIM = 1
@ -243,7 +240,6 @@ class OIDCClaimMapping(models.Model):
self.verified, self.required)
@six.python_2_unicode_compatible
class OIDCAccount(models.Model):
created = models.DateTimeField(
verbose_name=_('created'),

View File

@ -32,7 +32,6 @@ from authentic2.a2_rbac.models import Role, OrganizationalUnit as OU
logger = logging.getLogger('authentic2.auth_saml')
@six.python_2_unicode_compatible
class MappingError(Exception):
details = None

View File

@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.db import models
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django.core.validators import URLValidator
@ -29,7 +28,6 @@ from . import managers, utils, constants
url_validator = URLValidator(schemes=['http', 'https', 'ftp', 'ftps', 'imap', 'imaps', 'sieve', 'smtp', 'smtps', 'ssh'])
@six.python_2_unicode_compatible
class Service(LogoutUrlAbstract, Service):
urls = models.TextField(verbose_name=_('urls'))
identifier_attribute = models.CharField(max_length=64, verbose_name=_('attribute name'), blank=False)
@ -78,7 +76,6 @@ class Service(LogoutUrlAbstract, Service):
verbose_name_plural = _('services')
@six.python_2_unicode_compatible
class Attribute(models.Model):
service = models.ForeignKey(
Service,
@ -101,7 +98,6 @@ def make_uuid():
return utils.make_id(constants.SERVICE_TICKET_PREFIX)
@six.python_2_unicode_compatible
class Ticket(models.Model):
'''Session ticket with a CAS 1.0 or 2.0 consumer'''
ticket_id = models.CharField(max_length=64, verbose_name=_('ticket id'), unique=True, default=make_uuid)

View File

@ -403,7 +403,6 @@ GenericRelation('authentic2_idp_oidc.OIDCAuthorization',
OrganizationalUnit, 'oidc_authorizations')
@six.python_2_unicode_compatible
class OIDCClaim(models.Model):
client = models.ForeignKey(
to=OIDCClient,

View File

@ -21,7 +21,6 @@ from django.contrib import auth
from . import utils, constants, managers, backends
@six.python_2_unicode_compatible
class AbstractBase(models.Model):
'''Abstract base model for all models having a name and uuid and a
slug
@ -102,7 +101,6 @@ class OrganizationalUnit(OrganizationalUnitAbstractBase):
swappable = constants.RBAC_OU_MODEL_SETTING
@six.python_2_unicode_compatible
class Operation(models.Model):
name = models.CharField(
max_length=128,
@ -127,7 +125,6 @@ class Operation(models.Model):
Operation._meta.natural_key = ['slug']
@six.python_2_unicode_compatible
class PermissionAbstractBase(models.Model):
operation = models.ForeignKey(
to=Operation,