0001-python3-use-six.BytesIO-31152.patch
src/authentic2/management/commands/slapd-shell.py | ||
---|---|---|
2 | 2 | |
3 | 3 |
import logging |
4 | 4 |
import sys |
5 |
from StringIO import StringIO
|
|
5 |
from six import BytesIO
|
|
6 | 6 |
import re |
7 | 7 | |
8 | 8 |
from ldap.dn import escape_dn_chars |
... | ... | |
34 | 34 |
def ldap(self, command, attrs): |
35 | 35 |
self.logger.debug('received command %s %s', command, attrs) |
36 | 36 |
if command == 'SEARCH': |
37 |
out = StringIO()
|
|
37 |
out = BytesIO()
|
|
38 | 38 |
ldif_writer = LDIFWriter(out) |
39 | 39 |
qs = get_user_model().objects.all() |
40 | 40 |
if attrs['filter'] != '(objectClass=*)': |
src/authentic2/saml/management/commands/sync-metadata.py | ||
---|---|---|
4 | 4 |
import xml.etree.ElementTree as etree |
5 | 5 |
import os |
6 | 6 |
import requests |
7 |
from StringIO import StringIO
|
|
7 |
from six import BytesIO
|
|
8 | 8 |
import warnings |
9 | 9 | |
10 | 10 |
from django.core.management.base import BaseCommand, CommandError |
... | ... | |
305 | 305 |
response = requests.get(metadata_file_path) |
306 | 306 |
if not response.ok: |
307 | 307 |
raise CommandError('Unable to open url %s' % metadata_file_path) |
308 |
metadata_file = StringIO(response.content)
|
|
308 |
metadata_file = BytesIO(response.content)
|
|
309 | 309 |
else: |
310 | 310 |
try: |
311 | 311 |
metadata_file = file(metadata_file_path) |
tests/test_idp_saml2.py | ||
---|---|---|
2 | 2 |
import datetime |
3 | 3 |
import base64 |
4 | 4 |
import unittest |
5 |
import StringIO
|
|
5 |
from six import BytesIO
|
|
6 | 6 |
from lxml.html import parse |
7 | 7 | |
8 | 8 |
from django.test import Client |
... | ... | |
283 | 283 |
self.assertEqual(response.status_code, 200) |
284 | 284 |
self.assertEqual(response['Content-type'].split(';')[0], |
285 | 285 |
'text/html') |
286 |
doc = parse(StringIO.StringIO(response.content)).getroot()
|
|
286 |
doc = parse(BytesIO(response.content)).getroot()
|
|
287 | 287 |
self.assertEqual(len(doc.forms), 1, |
288 | 288 |
msg='the number of forms is not 1') |
289 | 289 |
self.assertEqual(doc.forms[0].get('action'), |
... | ... | |
328 | 328 |
response = client.get(response['Location']) |
329 | 329 |
self.assertEqual(response.status_code, 200) |
330 | 330 |
self.assertEqual(response['Content-type'].split(';')[0], 'text/html') |
331 |
doc = parse(StringIO.StringIO(response.content)).getroot()
|
|
331 |
doc = parse(BytesIO(response.content)).getroot()
|
|
332 | 332 |
self.assertEqual(len(doc.forms), 1, msg='the number of forms is not 1') |
333 | 333 |
self.assertEqual( |
334 | 334 |
doc.forms[0].get('action'), '%s/sso/POST' % self.base_url) |
335 |
- |