python-modernize

This commit is contained in:
Emmanuel Viennet 2021-07-09 17:52:32 +02:00
parent 7bb45516ed
commit 960de61928
2 changed files with 6 additions and 6 deletions

View File

@ -173,8 +173,8 @@ def scodoc7func(context):
elif arg_name == "context": elif arg_name == "context":
pos_arg_values.append(context) pos_arg_values.append(context)
else: else:
# XXX Convert to regular string for ScoDoc8/Python 2 # XXX Convert to regular string for ScoDoc8/Python 2 #py3
if type(req_args[arg_name]) == types.UnicodeType: if type(req_args[arg_name]) == str:
pos_arg_values.append(req_args[arg_name].encode("utf-8")) pos_arg_values.append(req_args[arg_name].encode("utf-8"))
else: else:
pos_arg_values.append(req_args[arg_name]) pos_arg_values.append(req_args[arg_name])
@ -186,8 +186,8 @@ def scodoc7func(context):
kwargs[arg_name] = REQUEST kwargs[arg_name] = REQUEST
elif arg_name in req_args: elif arg_name in req_args:
# set argument kw optionnel # set argument kw optionnel
# XXX Convert to regular string for ScoDoc8/Python 2 # XXX Convert to regular string for ScoDoc8/Python 2 #py3
if type(req_args[arg_name]) == types.UnicodeType: if type(req_args[arg_name]) == str:
kwargs[arg_name] = req_args[arg_name].encode("utf-8") kwargs[arg_name] = req_args[arg_name].encode("utf-8")
else: else:
kwargs[arg_name] = req_args[arg_name] kwargs[arg_name] = req_args[arg_name]

View File

@ -34,7 +34,7 @@ Emmanuel Viennet, 2021
import pprint import pprint
from pprint import pprint as pp from pprint import pprint as pp
import functools import functools
import thread # essai import six.moves._thread # essai
from zipfile import ZipFile from zipfile import ZipFile
from StringIO import StringIO from StringIO import StringIO
@ -156,7 +156,7 @@ def formsemestre_statux(dept_id=None, formsemestre_id=None, REQUEST=None):
@bp.route("/hello/world") @bp.route("/hello/world")
def hello(): def hello():
H = get_request_infos() + [ H = get_request_infos() + [
"<p>Hello, World! %s count=%s</p>" % (thread.get_ident(), D["count"]), "<p>Hello, World! %s count=%s</p>" % (six.moves._thread.get_ident(), D["count"]),
] ]
# print(pprint.pformat(dir(request))) # print(pprint.pformat(dir(request)))
return "\n".join(H) return "\n".join(H)