summaryrefslogtreecommitdiffstats
path: root/Lib/wsgiref
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-07 23:15:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-07 23:15:56 (GMT)
commit1325790b932c4bab4f8f94f5a36c09f4036ed9f8 (patch)
tree5f4c1d854783a4d082c5867094ec345f4772bf35 /Lib/wsgiref
parent7b955bd125951db694f19a1b8648b806b14bd61f (diff)
downloadcpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.zip
cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.gz
cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.bz2
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines Get rid of some remnants of classic classes. types.ClassType == type. Also get rid of almost all uses of the types module and use the builtin name. ........ r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line Remove a use of types, verify commit hook works ........ r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines Fix syntax error introduced by Neal in last checkin. ........
Diffstat (limited to 'Lib/wsgiref')
-rw-r--r--Lib/wsgiref/headers.py4
-rw-r--r--Lib/wsgiref/validate.py27
2 files changed, 14 insertions, 17 deletions
diff --git a/Lib/wsgiref/headers.py b/Lib/wsgiref/headers.py
index c364b26..c3774bb 100644
--- a/Lib/wsgiref/headers.py
+++ b/Lib/wsgiref/headers.py
@@ -5,8 +5,6 @@ so portions are Copyright (C) 2001,2002 Python Software Foundation, and were
written by Barry Warsaw.
"""
-from types import ListType, TupleType
-
# Regular expression that matches `special' characters in parameters, the
# existance of which force quoting of the parameter value.
import re
@@ -44,7 +42,7 @@ class Headers:
"""Manage a collection of HTTP response headers"""
def __init__(self,headers):
- if type(headers) is not ListType:
+ if not isinstance(headers, list):
raise TypeError("Headers must be a list of name/value tuples")
self._headers = headers
diff --git a/Lib/wsgiref/validate.py b/Lib/wsgiref/validate.py
index 09b0d95..fbd3536 100644
--- a/Lib/wsgiref/validate.py
+++ b/Lib/wsgiref/validate.py
@@ -113,7 +113,6 @@ __all__ = ['validator']
import re
import sys
-from types import DictType, StringType, TupleType, ListType
import warnings
header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$')
@@ -191,20 +190,20 @@ class InputWrapper:
def read(self, *args):
assert_(len(args) <= 1)
v = self.input.read(*args)
- assert_(type(v) is type(""))
+ assert_(isinstance(v, str))
return v
def readline(self):
v = self.input.readline()
- assert_(type(v) is type(""))
+ assert_(isinstance(v, str))
return v
def readlines(self, *args):
assert_(len(args) <= 1)
lines = self.input.readlines(*args)
- assert_(type(lines) is type([]))
+ assert_(isinstance(lines, list))
for line in lines:
- assert_(type(line) is type(""))
+ assert_(isinstance(line, str))
return lines
def __iter__(self):
@@ -223,7 +222,7 @@ class ErrorWrapper:
self.errors = wsgi_errors
def write(self, s):
- assert_(type(s) is type(""))
+ assert_(isinstance(s, str))
self.errors.write(s)
def flush(self):
@@ -242,7 +241,7 @@ class WriteWrapper:
self.writer = wsgi_writer
def __call__(self, s):
- assert_(type(s) is type(""))
+ assert_(isinstance(s, str))
self.writer(s)
class PartialIteratorWrapper:
@@ -288,7 +287,7 @@ class IteratorWrapper:
"Iterator garbage collected without being closed")
def check_environ(environ):
- assert_(type(environ) is DictType,
+ assert_(isinstance(environ, dict),
"Environment is not of the right type: %r (environment: %r)"
% (type(environ), environ))
@@ -315,11 +314,11 @@ def check_environ(environ):
if '.' in key:
# Extension, we don't care about its type
continue
- assert_(type(environ[key]) is StringType,
+ assert_(isinstance(environ[key], str),
"Environmental variable %s is not a string: %r (value: %r)"
% (key, type(environ[key]), environ[key]))
- assert_(type(environ['wsgi.version']) is TupleType,
+ assert_(isinstance(environ['wsgi.version'], tuple),
"wsgi.version should be a tuple (%r)" % (environ['wsgi.version'],))
assert_(environ['wsgi.url_scheme'] in ('http', 'https'),
"wsgi.url_scheme unknown: %r" % environ['wsgi.url_scheme'])
@@ -365,7 +364,7 @@ def check_errors(wsgi_errors):
% (wsgi_errors, attr))
def check_status(status):
- assert_(type(status) is StringType,
+ assert_(isinstance(status, str),
"Status must be a string (not %r)" % status)
# Implicitly check that we can turn it into an integer:
status_code = status.split(None, 1)[0]
@@ -380,12 +379,12 @@ def check_status(status):
% status, WSGIWarning)
def check_headers(headers):
- assert_(type(headers) is ListType,
+ assert_(isinstance(headers, list),
"Headers (%r) must be of type list: %r"
% (headers, type(headers)))
header_names = {}
for item in headers:
- assert_(type(item) is TupleType,
+ assert_(isinstance(item, tuple),
"Individual headers (%r) must be of type tuple: %r"
% (item, type(item)))
assert_(len(item) == 2)
@@ -419,7 +418,7 @@ def check_content_type(status, headers):
assert_(0, "No Content-Type header found in headers (%s)" % headers)
def check_exc_info(exc_info):
- assert_(exc_info is None or type(exc_info) is type(()),
+ assert_(exc_info is None or isinstance(exc_info, tuple),
"exc_info (%r) is not a tuple: %r" % (exc_info, type(exc_info)))
# More exc_info checks?