Changeset 6780
- Timestamp:
- 11/30/07 12:28:19 (10 months ago)
- Files:
-
- django/trunk/django/core/servers/basehttp.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/servers/basehttp.py
r6634 r6780 9 9 10 10 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer 11 from types import ListType, StringType12 11 import mimetypes 13 12 import os … … 73 72 """Manage a collection of HTTP response headers""" 74 73 def __init__(self,headers): 75 if type(headers) is not ListType:74 if not isinstance(headers, list): 76 75 raise TypeError("Headers must be a list of name/value tuples") 77 76 self._headers = headers … … 328 327 try: 329 328 blocks = len(self.result) 330 except (TypeError, AttributeError,NotImplementedError):329 except (TypeError, AttributeError, NotImplementedError): 331 330 pass 332 331 else: … … 357 356 raise AssertionError("Headers already set!") 358 357 359 assert type(status) is StringType,"Status must be a string"358 assert isinstance(status, str),"Status must be a string" 360 359 assert len(status)>=4,"Status must be at least 4 characters" 361 360 assert int(status[:3]),"Status message must begin w/3-digit code" … … 363 362 if __debug__: 364 363 for name,val in headers: 365 assert type(name) is StringType,"Header names must be strings"366 assert type(val) is StringType,"Header values must be strings"364 assert isinstance(name, str),"Header names must be strings" 365 assert isinstance(val, str),"Header values must be strings" 367 366 assert not is_hop_by_hop(name),"Hop-by-hop headers not allowed" 368 367 self.status = status … … 387 386 """'write()' callable as specified by PEP 333""" 388 387 389 assert type(data) is StringType,"write() argument must be string"388 assert isinstance(data, str), "write() argument must be string" 390 389 391 390 if not self.status:
