0003-py3ize-obviously-non-compatible-code-32866.patch
setup.py | ||
---|---|---|
15 | 15 |
# You should have received a copy of the GNU Affero General Public License |
16 | 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | |
18 |
from __future__ import print_function |
|
19 | ||
18 | 20 |
import sys |
19 | 21 |
import os |
20 | 22 |
import subprocess |
... | ... | |
50 | 52 |
call_command('compilemessages') |
51 | 53 |
os.chdir(curdir) |
52 | 54 |
except ImportError: |
53 |
|
|
55 |
print()
|
|
54 | 56 |
sys.stderr.write('!!! Please install Django >= 1.4 to build translations') |
55 |
|
|
56 |
|
|
57 |
print()
|
|
58 |
print()
|
|
57 | 59 |
os.chdir(curdir) |
58 | 60 | |
59 | 61 | |
... | ... | |
64 | 66 |
class eo_sdist(sdist): |
65 | 67 | |
66 | 68 |
def run(self): |
67 |
print "creating VERSION file"
|
|
69 |
print("creating VERSION file")
|
|
68 | 70 |
if os.path.exists('VERSION'): |
69 | 71 |
os.remove('VERSION') |
70 | 72 |
version = get_version() |
... | ... | |
72 | 74 |
version_file.write(version) |
73 | 75 |
version_file.close() |
74 | 76 |
sdist.run(self) |
75 |
print "removing VERSION file"
|
|
77 |
print("removing VERSION file")
|
|
76 | 78 |
if os.path.exists('VERSION'): |
77 | 79 |
os.remove('VERSION') |
78 | 80 | |
... | ... | |
108 | 110 |
['git', 'rev-list', 'HEAD']).splitlines()) |
109 | 111 |
return '0.0' |
110 | 112 | |
111 |
README = file(os.path.join( |
|
112 |
os.path.dirname(__file__), |
|
113 |
'README')).read() |
|
113 |
with open(os.path.join(os.path.dirname(__file__), 'README')) as fd: |
|
114 |
README = fd.read() |
|
114 | 115 | |
115 | 116 |
setup( |
116 | 117 |
name='authentic2-auth-fc', |
src/authentic2_auth_fc/utils.py | ||
---|---|---|
40 | 40 |
""" |
41 | 41 |
if not next_url: |
42 | 42 |
next_url = resolve_url(settings.LOGIN_REDIRECT_URL) |
43 |
state = unicode(uuid.uuid4())
|
|
43 |
state = str(uuid.uuid4())
|
|
44 | 44 |
states = request.session.setdefault('fc_states', {}) |
45 | 45 |
request.session.modified = True |
46 | 46 |
states[state] = { |
... | ... | |
93 | 93 |
if mapping['compute'] == 'today': |
94 | 94 |
value = datetime.date.today() |
95 | 95 |
elif mapping['compute'] == 'random': |
96 |
value = unicode(uuid.uuid4())
|
|
96 |
value = str(uuid.uuid4())
|
|
97 | 97 |
else: |
98 | 98 |
raise NotImplementedError |
99 | 99 | |
... | ... | |
151 | 151 |
save_user = False |
152 | 152 |
tags = set() |
153 | 153 |
for attribute, mapping in mappings.iteritems(): |
154 |
# normalize mapping to dictionaries |
|
155 |
if isinstance(mapping, basestring):
|
|
154 |
# normalize mapping to dictionaries: if string, convert into a simple reference
|
|
155 |
if hasattr(mapping, 'format'):
|
|
156 | 156 |
mapping = {'ref': mapping} |
157 | 157 |
try: |
158 | 158 |
value = mapping_to_value(mapping, user_info) |
src/authentic2_auth_fc/views.py | ||
---|---|---|
72 | 72 |
if not isinstance(scopes, (list, tuple)): |
73 | 73 |
scopes = [scopes] |
74 | 74 |
redirect_uri = request.build_absolute_uri() |
75 |
state = unicode(uuid.uuid4())
|
|
75 |
state = str(uuid.uuid4())
|
|
76 | 76 |
states = request.session.setdefault('fc_states', {}) |
77 | 77 |
states[state] = { |
78 | 78 |
'redirect_uri': redirect_uri, |
... | ... | |
274 | 274 |
messages.warning(request, _('Unable to connect to FranceConnect.')) |
275 | 275 |
return self.redirect(request) |
276 | 276 |
key = app_settings.client_secret |
277 |
if isinstance(key, unicode): |
|
277 |
# duck-type unicode/Py3 strings |
|
278 |
if hasattr(key, 'isdecimal'): |
|
278 | 279 |
key = key.encode('utf-8') |
279 | 280 |
self.id_token, error = models.parse_id_token( |
280 | 281 |
self.token['id_token'], client_id=app_settings.client_id, client_secret=key) |
281 |
- |