0001-python3-remove-deprecated-basestring-builtin-31159.patch
src/authentic2/backends/ldap_backend.py | ||
---|---|---|
27 | 27 |
from django.conf import settings |
28 | 28 |
from django.contrib.auth.models import Group |
29 | 29 |
from django.utils.encoding import force_bytes, force_text |
30 |
from six import string_types |
|
30 | 31 | |
31 | 32 |
from authentic2.a2_rbac.models import Role |
32 | 33 | |
... | ... | |
795 | 796 |
'''Obtain a Django role''' |
796 | 797 |
kwargs = {} |
797 | 798 |
slug = None |
798 |
if isinstance(role_id, basestring):
|
|
799 |
if isinstance(role_id, string_types):
|
|
799 | 800 |
slug = role_id |
800 | 801 |
elif isinstance(role_id, (tuple, list)): |
801 | 802 |
try: |
src/authentic2/migrations/__init__.py | ||
---|---|---|
1 | 1 |
import itertools |
2 | 2 | |
3 | 3 |
from django.db.migrations.operations.base import Operation |
4 |
from six import string_types |
|
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, 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, 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 | ||
---|---|---|
8 | 8 |
import datetime |
9 | 9 |
import time |
10 | 10 | |
11 |
from six import string_types |
|
12 | ||
11 | 13 | |
12 | 14 |
def filter_attribute_private_key(message): |
13 |
if isinstance(message, basestring):
|
|
15 |
if isinstance(message, string_types):
|
|
14 | 16 |
return re.sub(r' (\w+:)?(PrivateKey=")([&#;\w/ +-=])+(")', '', message) |
15 | 17 |
else: |
16 | 18 |
return message |
17 | 19 | |
18 | 20 | |
19 | 21 |
def filter_element_private_key(message): |
20 |
if isinstance(message, basestring):
|
|
22 |
if isinstance(message, string_types):
|
|
21 | 23 |
return re.sub(r'(<saml)(p)?(:PrivateKeyFile>-----BEGIN RSA PRIVATE KEY-----)' |
22 | 24 |
'([&#;\w/+=\s])+' |
23 | 25 |
'(-----END RSA PRIVATE KEY-----</saml)(p)?(:PrivateKeyFile>)', |
src/authentic2/utils.py | ||
---|---|---|
36 | 36 |
from django.utils.http import urlsafe_base64_encode |
37 | 37 |
from django.utils.encoding import iri_to_uri, force_bytes, uri_to_iri |
38 | 38 |
from django.shortcuts import render |
39 |
from six import string_types |
|
39 | 40 | |
40 | 41 | |
41 | 42 |
try: |
... | ... | |
536 | 537 |
def normalize_attribute_values(values): |
537 | 538 |
'''Take a list of values or a single one and normalize it''' |
538 | 539 |
values_set = set() |
539 |
if isinstance(values, basestring) or not hasattr(values, '__iter__'):
|
|
540 |
if isinstance(values, string_types) or not hasattr(values, '__iter__'):
|
|
540 | 541 |
values = [values] |
541 | 542 |
for value in values: |
542 | 543 |
if isinstance(value, bool): |
... | ... | |
591 | 592 |
- <template_name>_body.html for the HTML body |
592 | 593 |
''' |
593 | 594 |
from . import middleware |
594 |
if isinstance(template_names, basestring):
|
|
595 |
if isinstance(template_names, string_types):
|
|
595 | 596 |
template_names = [template_names] |
596 | 597 |
if hasattr(user_or_email, 'email'): |
597 | 598 |
user_or_email = user_or_email.email |
src/authentic2_idp_oidc/utils.py | ||
---|---|---|
6 | 6 | |
7 | 7 |
from jwcrypto.jwk import JWK, JWKSet, InvalidJWKValue |
8 | 8 |
from jwcrypto.jwt import JWT |
9 |
from six import string_types |
|
9 | 10 | |
10 | 11 |
from django.core.exceptions import ImproperlyConfigured |
11 | 12 |
from django.conf import settings |
... | ... | |
152 | 153 | |
153 | 154 |
def normalize_claim_values(values): |
154 | 155 |
values_list = [] |
155 |
if isinstance(values, basestring) or not hasattr(values, '__iter__'):
|
|
156 |
if isinstance(values, string_types) or not hasattr(values, '__iter__'):
|
|
156 | 157 |
return values |
157 | 158 |
for value in values: |
158 | 159 |
if isinstance(value, bool): |
src/authentic2_provisionning_ldap/management/commands/provision.py | ||
---|---|---|
5 | 5 |
except ImportError: |
6 | 6 |
ldap = None |
7 | 7 |
from ldaptools import paged |
8 |
from six import string_types |
|
8 | 9 | |
9 | 10 |
from django.core.management.base import BaseCommand |
10 | 11 | |
... | ... | |
73 | 74 |
return dn2str(dn), ('&', [(a,b) for a, b, c in rdn]) |
74 | 75 | |
75 | 76 |
def format_filter(self, filters): |
76 |
if isinstance(filters, basestring):
|
|
77 |
if isinstance(filters, string_types):
|
|
77 | 78 |
return filters |
78 | 79 |
assert len(filters) == 2, 'filters %r' % (filters,) |
79 | 80 |
if isinstance(filters[1], (list, tuple)): |
src/django_rbac/backends.py | ||
---|---|---|
9 | 9 |
except ImportError: |
10 | 10 |
# Django < 1.8 |
11 | 11 |
from django.db.models.fields import FieldDoesNotExist |
12 |
from six import string_types |
|
12 | 13 | |
13 | 14 |
from . import utils |
14 | 15 | |
... | ... | |
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, 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, 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 six import string_types |
|
13 | 14 | |
14 | 15 |
from authentic2 import utils |
15 | 16 | |
... | ... | |
110 | 111 |
for xpath, content in constraints: |
111 | 112 |
nodes = doc.xpath(xpath, namespaces=namespaces) |
112 | 113 |
self.assertTrue(len(nodes) > 0, 'xpath %s not found' % xpath) |
113 |
if isinstance(content, basestring):
|
|
114 |
if isinstance(content, string_types):
|
|
114 | 115 |
for node in nodes: |
115 | 116 |
if hasattr(node, 'text'): |
116 | 117 |
self.assertEqual( |
117 |
- |