forked from ScoDoc/ScoDoc
removed StringType
This commit is contained in:
parent
2bc3dc66a3
commit
c71dcd3824
@ -9,7 +9,7 @@
|
||||
v 1.2
|
||||
"""
|
||||
|
||||
from types import BooleanType, StringType, UnicodeType
|
||||
from types import BooleanType, UnicodeType
|
||||
|
||||
|
||||
def TrivialFormulator(
|
||||
@ -745,7 +745,7 @@ def dict2js(d):
|
||||
v = "true"
|
||||
else:
|
||||
v = "false"
|
||||
elif type(v) == StringType or type(v) == UnicodeType:
|
||||
elif isinstance(v, str): # ne marchera pas en python2
|
||||
v = '"' + v + '"'
|
||||
|
||||
r.append("%s: %s" % (k, v))
|
||||
@ -756,7 +756,7 @@ def tf_error_message(msg):
|
||||
"""html for form error message"""
|
||||
if not msg:
|
||||
return ""
|
||||
if type(msg) == StringType:
|
||||
if isinstance(msg, str):
|
||||
msg = [msg]
|
||||
return (
|
||||
'<ul class="tf-msg"><li class="tf-msg">%s</li></ul>'
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
"""Calculs sur les notes et cache des resultats
|
||||
"""
|
||||
from types import StringType, FloatType
|
||||
from types import FloatType
|
||||
import time
|
||||
import pdb
|
||||
import inspect
|
||||
|
@ -13,7 +13,6 @@ from flask import g
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.notes_log import log
|
||||
from app.scodoc.sco_exceptions import ScoException, ScoValueError, NoteProcessError
|
||||
from types import StringType
|
||||
from cgi import escape
|
||||
import datetime
|
||||
|
||||
@ -24,7 +23,7 @@ def quote_dict(d):
|
||||
"html quote all values in dict"
|
||||
for k in d.keys():
|
||||
v = d[k]
|
||||
if type(v) == StringType:
|
||||
if isinstance(v, str):
|
||||
d[k] = quote_html(v, quote=True)
|
||||
|
||||
|
||||
@ -475,7 +474,7 @@ def DateDMYtoISO(dmy, null_is_empty=False):
|
||||
return ""
|
||||
else:
|
||||
return None
|
||||
if type(dmy) != StringType:
|
||||
if not isinstance(dmy, str):
|
||||
return dmy.strftime("%Y-%m-%d")
|
||||
|
||||
t = dmy.split("/")
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
"""
|
||||
import time
|
||||
from types import StringType
|
||||
import pprint
|
||||
import email
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
@ -249,7 +248,7 @@ def formsemestre_bulletinetud_dict(
|
||||
I["sum_ects"] = 0
|
||||
I["sum_ects_capitalises"] = 0
|
||||
I["moy_moy"] = scu.fmt_note(nt.moy_moy) # moyenne des moyennes generales
|
||||
if type(moy_gen) != StringType and type(nt.moy_moy) != StringType:
|
||||
if (not isinstance(moy_gen, str)) and (not isinstance(nt.moy_moy, str)):
|
||||
I["moy_gen_bargraph_html"] = " " + htmlutils.horizontal_bargraph(
|
||||
moy_gen * 5, nt.moy_moy * 5
|
||||
)
|
||||
@ -299,7 +298,7 @@ def formsemestre_bulletinetud_dict(
|
||||
u["cur_moy_ue_txt"] = scu.fmt_note(ue_status["cur_moy_ue"])
|
||||
else:
|
||||
x = scu.fmt_note(nt.bonus[etudid], keep_numeric=True)
|
||||
if type(x) == StringType:
|
||||
if isinstance(x, str):
|
||||
u["cur_moy_ue_txt"] = "pas de bonus"
|
||||
else:
|
||||
u["cur_moy_ue_txt"] = "bonus de %.3g points" % x
|
||||
|
@ -28,7 +28,6 @@
|
||||
"""
|
||||
Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant
|
||||
"""
|
||||
from types import StringType
|
||||
import safehtml
|
||||
|
||||
from flask import url_for, g
|
||||
@ -377,7 +376,7 @@ def itemsuivi_tag_set(context, itemsuivi_id="", taglist=[], REQUEST=None):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
if not taglist:
|
||||
taglist = []
|
||||
elif type(taglist) == StringType:
|
||||
elif isinstance(taglist, str):
|
||||
taglist = taglist.split(",")
|
||||
taglist = [t.strip() for t in taglist]
|
||||
# log('itemsuivi_tag_set: itemsuivi_id=%s taglist=%s' % (itemsuivi_id, taglist))
|
||||
|
@ -29,7 +29,7 @@
|
||||
""" Excel file handling
|
||||
"""
|
||||
import time, datetime
|
||||
from types import StringType, IntType, FloatType, LongType
|
||||
from types import IntType, FloatType, LongType
|
||||
|
||||
from pyExcelerator import *
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
"""
|
||||
|
||||
import operator
|
||||
from types import FloatType, IntType, LongType, StringType
|
||||
from types import FloatType, IntType, LongType
|
||||
from functools import reduce
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class NoteVector(object):
|
||||
try:
|
||||
return self.v[i]
|
||||
except:
|
||||
if type(i) == StringType:
|
||||
if isinstance(i, str):
|
||||
return self.v[self.name_idx[i]]
|
||||
else:
|
||||
raise IndexError("index %s out of range" % i)
|
||||
|
@ -28,7 +28,6 @@
|
||||
"""Liste des notes d'une évaluation
|
||||
"""
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
from types import StringType
|
||||
from operator import itemgetter
|
||||
|
||||
from flask import url_for, g
|
||||
@ -672,7 +671,7 @@ def _add_moymod_column(
|
||||
) # note sur 20, ou 'NA','NI'
|
||||
row[col_id] = scu.fmt_note(val, keep_numeric=keep_numeric)
|
||||
row["_" + col_id + "_td_attrs"] = ' class="moyenne" '
|
||||
if type(val) != StringType:
|
||||
if isinstance(val, str):
|
||||
notes.append(val)
|
||||
nb_notes = nb_notes + 1
|
||||
sum_notes += val
|
||||
|
@ -35,7 +35,6 @@ import time
|
||||
import cStringIO
|
||||
import re
|
||||
import os
|
||||
from types import StringType
|
||||
import unicodedata
|
||||
import traceback
|
||||
import reportlab
|
||||
@ -249,7 +248,7 @@ class ScolarsPageTemplate(PageTemplate):
|
||||
|
||||
# ---- Filigranne (texte en diagonal en haut a gauche de chaque page)
|
||||
if self.filigranne:
|
||||
if type(self.filigranne) == StringType:
|
||||
if isinstance(self.filigranne, str):
|
||||
filigranne = self.filigranne # same for all pages
|
||||
else:
|
||||
filigranne = self.filigranne.get(doc.page, None)
|
||||
|
@ -26,7 +26,7 @@ for srcfilename in sys.argv[1:]:
|
||||
# L.extend(x.s.strip() for x in ast.walk(p) if x.__class__ == ast.Str)
|
||||
for x in ast.walk(p):
|
||||
if x.__class__ == ast.Str:
|
||||
if type(x.s) == types.StringType:
|
||||
if isinstance(x.s, str):
|
||||
s = x.s
|
||||
else:
|
||||
s = x.s.encode("UTF-8")
|
||||
|
Loading…
Reference in New Issue
Block a user