1
0
forked from ScoDoc/ScoDoc

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":
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]

View File

@ -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() + [
"<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)))
return "\n".join(H)