From 159373a0191ed3acc353fc34daad4e7d3848c465 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 18 Jun 2018 00:50:47 +0000 Subject: [PATCH 47/54] Python 3 preparation: avoid obsolete types.*Type names. --- roundup/cgi/TAL/TALDefs.py | 6 ++---- roundup/cgi/TAL/TALInterpreter.py | 1 - roundup/cgi/cgitb.py | 9 ++++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/roundup/cgi/TAL/TALDefs.py b/roundup/cgi/TAL/TALDefs.py index 09b4e01..1f33ee2 100644 --- a/roundup/cgi/TAL/TALDefs.py +++ b/roundup/cgi/TAL/TALDefs.py @@ -17,8 +17,6 @@ Common definitions used by TAL and METAL compilation an transformation. """ -from types import ListType, TupleType - #from ITALES import ITALESErrorInfo TAL_VERSION = "1.4" @@ -156,7 +154,7 @@ def isCurrentVersion(program): def getProgramMode(program): version = getProgramVersion(program) - if (version == TAL_VERSION and isinstance(program[1], TupleType) and + if (version == TAL_VERSION and isinstance(program[1], tuple) and len(program[1]) == 2): opcode, mode = program[1] if opcode == "mode": @@ -165,7 +163,7 @@ def getProgramMode(program): def getProgramVersion(program): if (len(program) >= 2 and - isinstance(program[0], TupleType) and len(program[0]) == 2): + isinstance(program[0], tuple) and len(program[0]) == 2): opcode, version = program[0] if opcode == "version": return version diff --git a/roundup/cgi/TAL/TALInterpreter.py b/roundup/cgi/TAL/TALInterpreter.py index c7bf960..07112cd 100644 --- a/roundup/cgi/TAL/TALInterpreter.py +++ b/roundup/cgi/TAL/TALInterpreter.py @@ -20,7 +20,6 @@ Interpreter for a pre-compiled TAL program. import sys import getopt import re -from types import ListType from cgi import escape from roundup.anypy.strings import StringIO #from DocumentTemplate.DT_Util import ustr diff --git a/roundup/cgi/cgitb.py b/roundup/cgi/cgitb.py index 7671ed7..58b3fd0 100644 --- a/roundup/cgi/cgitb.py +++ b/roundup/cgi/cgitb.py @@ -7,7 +7,7 @@ from __future__ import print_function __docformat__ = 'restructuredtext' -import sys, os, types, string, keyword, linecache, tokenize, inspect, cgi +import sys, os, string, keyword, linecache, tokenize, inspect, cgi import pydoc, traceback from roundup.cgi import templating, TranslationService @@ -206,10 +206,9 @@ def html(context=5, i18n=None): exception = '

%s: %s' % (str(etype), str(evalue)) attribs = [] - if type(evalue) is types.InstanceType: - for name in dir(evalue): - value = pydoc.html.repr(getattr(evalue, name)) - attribs.append('
%s%s = %s' % (indent, name, value)) + for name in dir(evalue): + value = pydoc.html.repr(getattr(evalue, name)) + attribs.append('
%s%s = %s' % (indent, name, value)) return head + string.join(attribs) + string.join(traceback) + '

 

' -- 2.7.4