0001-python3-remove-deprecated-basestring-builtin-31159.patch
src/authentic2/backends/ldap_backend.py | ||
---|---|---|
14 | 14 |
import logging |
15 | 15 |
import random |
16 | 16 |
import base64 |
17 |
import six |
|
18 | 17 |
import os |
19 | 18 | |
20 | 19 |
# code originaly copied from by now merely inspired by |
... | ... | |
27 | 26 |
from django.contrib.auth.models import Group |
28 | 27 |
from django.utils.encoding import force_bytes, force_text |
29 | 28 |
from django.utils.six.moves.urllib import parse as urlparse |
29 |
from django.utils import six |
|
30 | 30 | |
31 | 31 |
from authentic2.a2_rbac.models import Role |
32 | 32 | |
... | ... | |
797 | 797 |
'''Obtain a Django role''' |
798 | 798 |
kwargs = {} |
799 | 799 |
slug = None |
800 |
if isinstance(role_id, basestring):
|
|
800 |
if isinstance(role_id, six.string_types):
|
|
801 | 801 |
slug = role_id |
802 | 802 |
elif isinstance(role_id, (tuple, list)): |
803 | 803 |
try: |
src/authentic2/migrations/__init__.py | ||
---|---|---|
1 | 1 |
import itertools |
2 | 2 | |
3 | 3 |
from django.db.migrations.operations.base import Operation |
4 |
from django.utils import six |
|
4 | 5 | |
5 | 6 | |
6 | 7 |
class CreatePartialIndexes(Operation): |
... | ... | |
55 | 56 |
for clause in where: |
56 | 57 |
if isinstance(clause, tuple): |
57 | 58 |
clause, params = clause |
58 |
assert isinstance(clause, basestring)
|
|
59 |
assert isinstance(clause, six.string_types)
|
|
59 | 60 |
assert isinstance(params, tuple) |
60 | 61 |
clause = clause % tuple(schema_editor.quote_value(param) for param in |
61 | 62 |
params) |
62 |
assert isinstance(clause, basestring)
|
|
63 |
assert isinstance(clause, six.string_types)
|
|
63 | 64 |
clauses.append(clause) |
64 | 65 |
where_clause = ' AND '.join(clauses) |
65 | 66 |
# SQLite does not accept parameters in partial index creations, don't ask why :/ |
src/authentic2/saml/saml2utils.py | ||
---|---|---|
10 | 10 |
import datetime |
11 | 11 |
import time |
12 | 12 | |
13 |
from django.utils import six |
|
14 | ||
13 | 15 | |
14 | 16 |
def filter_attribute_private_key(message): |
15 |
if isinstance(message, basestring):
|
|
17 |
if isinstance(message, six.string_types):
|
|
16 | 18 |
return re.sub(r' (\w+:)?(PrivateKey=")([&#;\w/ +-=])+(")', '', message) |
17 | 19 |
else: |
18 | 20 |
return message |
19 | 21 | |
20 | 22 | |
21 | 23 |
def filter_element_private_key(message): |
22 |
if isinstance(message, basestring):
|
|
24 |
if isinstance(message, six.string_types):
|
|
23 | 25 |
return re.sub(r'(<saml)(p)?(:PrivateKeyFile>-----BEGIN RSA PRIVATE KEY-----)' |
24 | 26 |
'([&#;\w/+=\s])+' |
25 | 27 |
'(-----END RSA PRIVATE KEY-----</saml)(p)?(:PrivateKeyFile>)', |
src/authentic2/utils.py | ||
---|---|---|
31 | 31 |
from django.core.urlresolvers import reverse, NoReverseMatch |
32 | 32 |
from django.utils.formats import localize |
33 | 33 |
from django.contrib import messages |
34 |
from django.utils import six |
|
34 | 35 |
from django.utils.functional import empty, allow_lazy |
35 | 36 |
from django.utils.http import urlsafe_base64_encode |
36 | 37 |
from django.utils.encoding import iri_to_uri, force_bytes, uri_to_iri |
... | ... | |
535 | 536 |
def normalize_attribute_values(values): |
536 | 537 |
'''Take a list of values or a single one and normalize it''' |
537 | 538 |
values_set = set() |
538 |
if isinstance(values, basestring) or not hasattr(values, '__iter__'):
|
|
539 |
if isinstance(values, six.string_types) or not hasattr(values, '__iter__'):
|
|
539 | 540 |
values = [values] |
540 | 541 |
for value in values: |
541 | 542 |
if isinstance(value, bool): |
... | ... | |
590 | 591 |
- <template_name>_body.html for the HTML body |
591 | 592 |
''' |
592 | 593 |
from . import middleware |
593 |
if isinstance(template_names, basestring):
|
|
594 |
if isinstance(template_names, six.string_types):
|
|
594 | 595 |
template_names = [template_names] |
595 | 596 |
if hasattr(user_or_email, 'email'): |
596 | 597 |
user_or_email = user_or_email.email |
src/authentic2_idp_oidc/utils.py | ||
---|---|---|
3 | 3 |
import base64 |
4 | 4 |
import uuid |
5 | 5 | |
6 |
from six import text_type, string_types |
|
7 | ||
8 | 6 |
from jwcrypto.jwk import JWK, JWKSet, InvalidJWKValue |
9 | 7 |
from jwcrypto.jwt import JWT |
10 | 8 | |
11 | 9 |
from django.core.exceptions import ImproperlyConfigured |
12 | 10 |
from django.conf import settings |
11 |
from django.utils import six |
|
13 | 12 |
from django.utils.encoding import force_bytes, force_text |
14 | 13 |
from django.utils.six.moves.urllib import parse as urlparse |
15 | 14 | |
... | ... | |
72 | 71 | |
73 | 72 |
def clean_words(data): |
74 | 73 |
'''Clean and order a list of words''' |
75 |
return u' '.join(sorted(map(text_type.strip, data.split()))) |
|
74 |
return u' '.join(sorted(map(six.text_type.strip, data.split())))
|
|
76 | 75 | |
77 | 76 | |
78 | 77 |
def url_domain(url): |
... | ... | |
154 | 153 | |
155 | 154 |
def normalize_claim_values(values): |
156 | 155 |
values_list = [] |
157 |
if isinstance(values, string_types) or not hasattr(values, '__iter__'): |
|
156 |
if isinstance(values, six.string_types) or not hasattr(values, '__iter__'):
|
|
158 | 157 |
return values |
159 | 158 |
for value in values: |
160 | 159 |
if isinstance(value, bool): |
src/authentic2_provisionning_ldap/management/commands/provision.py | ||
---|---|---|
9 | 9 |
from ldaptools import paged |
10 | 10 | |
11 | 11 |
from django.core.management.base import BaseCommand |
12 |
from django.utils import six |
|
12 | 13 | |
13 | 14 |
from authentic2.attributes_ng.engine import get_attributes |
14 | 15 |
from authentic2 import compat, utils |
... | ... | |
75 | 76 |
return dn2str(dn), ('&', [(a,b) for a, b, c in rdn]) |
76 | 77 | |
77 | 78 |
def format_filter(self, filters): |
78 |
if isinstance(filters, basestring):
|
|
79 |
if isinstance(filters, six.string_types):
|
|
79 | 80 |
return filters |
80 | 81 |
assert len(filters) == 2, 'filters %r' % (filters,) |
81 | 82 |
if isinstance(filters[1], (list, tuple)): |
src/django_rbac/backends.py | ||
---|---|---|
3 | 3 |
from django.conf import settings |
4 | 4 |
from django.contrib.contenttypes.models import ContentType |
5 | 5 |
from django.db.models.query import Q |
6 |
from django.utils import six |
|
6 | 7 | |
7 | 8 |
try: |
8 | 9 |
from django.core.exceptions import FieldDoesNotExist |
... | ... | |
142 | 143 |
return False |
143 | 144 |
if user_obj.is_superuser: |
144 | 145 |
return True |
145 |
if isinstance(perm_or_perms, basestring):
|
|
146 |
if isinstance(perm_or_perms, six.string_types):
|
|
146 | 147 |
perm_or_perms = [perm_or_perms] |
147 | 148 |
perm_or_perms = set(perm_or_perms) |
148 | 149 |
cache = self.get_permission_cache(user_obj) |
... | ... | |
171 | 172 |
return False |
172 | 173 |
if user_obj.is_superuser: |
173 | 174 |
return True |
174 |
if isinstance(perm_or_perms, basestring):
|
|
175 |
if isinstance(perm_or_perms, six.string_types):
|
|
175 | 176 |
perm_or_perms = [perm_or_perms] |
176 | 177 |
perm_or_perms = set(perm_or_perms) |
177 | 178 |
cache = self.get_permission_cache(user_obj) |
tests/utils.py | ||
---|---|---|
10 | 10 |
from django.conf import settings |
11 | 11 |
from django.utils.encoding import iri_to_uri |
12 | 12 |
from django.shortcuts import resolve_url |
13 |
from django.utils import six |
|
13 | 14 |
from django.utils.six.moves.urllib import parse as urlparse |
14 | 15 | |
15 | 16 |
from authentic2 import utils |
... | ... | |
111 | 112 |
for xpath, content in constraints: |
112 | 113 |
nodes = doc.xpath(xpath, namespaces=namespaces) |
113 | 114 |
self.assertTrue(len(nodes) > 0, 'xpath %s not found' % xpath) |
114 |
if isinstance(content, basestring):
|
|
115 |
if isinstance(content, six.string_types):
|
|
115 | 116 |
for node in nodes: |
116 | 117 |
if hasattr(node, 'text'): |
117 | 118 |
self.assertEqual( |
118 |
- |