From 70a6b49821a3226f55e9716f32d802d06640cb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Thu, 12 Feb 2004 17:35:32 +0000 Subject: Replace backticks with repr() or "%r" From SF patch #852334. --- Lib/cgi.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Lib/cgi.py') diff --git a/Lib/cgi.py b/Lib/cgi.py index ac7192b84f..2576e75aaf 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -212,7 +212,7 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): nv = name_value.split('=', 1) if len(nv) != 2: if strict_parsing: - raise ValueError, "bad query field: %s" % `name_value` + raise ValueError, "bad query field: %r" % (name_value,) continue if len(nv[1]) or keep_blank_values: name = urllib.unquote(nv[0].replace('+', ' ')) @@ -247,8 +247,8 @@ def parse_multipart(fp, pdict): if 'boundary' in pdict: boundary = pdict['boundary'] if not valid_boundary(boundary): - raise ValueError, ('Invalid boundary in multipart form: %s' - % `boundary`) + raise ValueError, ('Invalid boundary in multipart form: %r' + % (boundary,)) nextpart = "--" + boundary lastpart = "--" + boundary + "--" @@ -361,7 +361,7 @@ class MiniFieldStorage: def __repr__(self): """Return printable representation.""" - return "MiniFieldStorage(%s, %s)" % (`self.name`, `self.value`) + return "MiniFieldStorage(%r, %r)" % (self.name, self.value) class FieldStorage: @@ -522,8 +522,8 @@ class FieldStorage: def __repr__(self): """Return a printable representation.""" - return "FieldStorage(%s, %s, %s)" % ( - `self.name`, `self.filename`, `self.value`) + return "FieldStorage(%r, %r, %r)" % ( + self.name, self.filename, self.value) def __iter__(self): return iter(self.keys()) @@ -632,8 +632,7 @@ class FieldStorage: """Internal: read a part that is itself multipart.""" ib = self.innerboundary if not valid_boundary(ib): - raise ValueError, ('Invalid boundary in multipart form: %s' - % `ib`) + raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,) self.list = [] klass = self.FieldStorageClass or self.__class__ part = klass(self.fp, {}, ib, @@ -957,8 +956,8 @@ def print_form(form): for key in keys: print "
" + escape(key) + ":", value = form[key] - print "" + escape(`type(value)`) + "" - print "
" + escape(`value`) + print "" + escape(repr(type(value))) + "" + print "
" + escape(repr(value)) print "" print -- cgit v1.2.1