From 960de619289bf90cffd4a7834590186b4b3ffe0e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 9 Jul 2021 17:52:32 +0200 Subject: [PATCH] python-modernize --- app/decorators.py | 8 ++++---- app/main/routes.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/decorators.py b/app/decorators.py index 380ca849a..af4223b60 100644 --- a/app/decorators.py +++ b/app/decorators.py @@ -173,8 +173,8 @@ def scodoc7func(context): elif arg_name == "context": pos_arg_values.append(context) else: - # XXX Convert to regular string for ScoDoc8/Python 2 - if type(req_args[arg_name]) == types.UnicodeType: + # XXX Convert to regular string for ScoDoc8/Python 2 #py3 + if type(req_args[arg_name]) == str: pos_arg_values.append(req_args[arg_name].encode("utf-8")) else: pos_arg_values.append(req_args[arg_name]) @@ -186,8 +186,8 @@ def scodoc7func(context): kwargs[arg_name] = REQUEST elif arg_name in req_args: # set argument kw optionnel - # XXX Convert to regular string for ScoDoc8/Python 2 - if type(req_args[arg_name]) == types.UnicodeType: + # XXX Convert to regular string for ScoDoc8/Python 2 #py3 + if type(req_args[arg_name]) == str: kwargs[arg_name] = req_args[arg_name].encode("utf-8") else: kwargs[arg_name] = req_args[arg_name] diff --git a/app/main/routes.py b/app/main/routes.py index f504a37c1..72a8d7753 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -34,7 +34,7 @@ Emmanuel Viennet, 2021 import pprint from pprint import pprint as pp import functools -import thread # essai +import six.moves._thread # essai from zipfile import ZipFile from StringIO import StringIO @@ -156,7 +156,7 @@ def formsemestre_statux(dept_id=None, formsemestre_id=None, REQUEST=None): @bp.route("/hello/world") def hello(): H = get_request_infos() + [ - "

Hello, World! %s count=%s

" % (thread.get_ident(), D["count"]), + "

Hello, World! %s count=%s

" % (six.moves._thread.get_ident(), D["count"]), ] # print(pprint.pformat(dir(request))) return "\n".join(H)