Kaydet (Commit) 403019b1 authored tarafından Phillip J. Eby's avatar Phillip J. Eby

Sync w/external release 0.1.2. Please see PEP 360 before making changes to external packages.

üst 6e73aaab
...@@ -80,7 +80,7 @@ def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"): ...@@ -80,7 +80,7 @@ def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"):
def compare_generic_iter(test, make_it, match): def compare_generic_iter(make_it,match):
"""Utility to compare a generic 2.1/2.2+ iterator with an iterable """Utility to compare a generic 2.1/2.2+ iterator with an iterable
If running under Python 2.2+, this tests the iterator using iter()/next(), If running under Python 2.2+, this tests the iterator using iter()/next(),
...@@ -90,7 +90,7 @@ def compare_generic_iter(test, make_it, match): ...@@ -90,7 +90,7 @@ def compare_generic_iter(test, make_it, match):
it = make_it() it = make_it()
n = 0 n = 0
for item in match: for item in match:
test.assertEqual(it[n], item) if not it[n]==item: raise AssertionError
n+=1 n+=1
try: try:
it[n] it[n]
...@@ -106,10 +106,15 @@ def compare_generic_iter(test, make_it, match): ...@@ -106,10 +106,15 @@ def compare_generic_iter(test, make_it, match):
else: else:
# Only test iter mode under 2.2+ # Only test iter mode under 2.2+
it = make_it() it = make_it()
test.assert_(iter(it) is it) if not iter(it) is it: raise AssertionError
for item in match: for item in match:
test.assertEqual(it.next(), item) if not it.next()==item: raise AssertionError
test.assertRaises(StopIteration, it.next) try:
it.next()
except StopIteration:
pass
else:
raise AssertionError("Too many items from .next()",it)
...@@ -203,7 +208,7 @@ class UtilityTests(TestCase): ...@@ -203,7 +208,7 @@ class UtilityTests(TestCase):
def make_it(text=text,size=size): def make_it(text=text,size=size):
return util.FileWrapper(StringIO(text),size) return util.FileWrapper(StringIO(text),size)
compare_generic_iter(self, make_it, match) compare_generic_iter(make_it,match)
it = make_it() it = make_it()
self.failIf(it.filelike.closed) self.failIf(it.filelike.closed)
......
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: wsgiref Name: wsgiref
Version: 0.1 Version: 0.1.2
Summary: WSGI (PEP 333) Reference Library Summary: WSGI (PEP 333) Reference Library
Author: Phillip J. Eby Author: Phillip J. Eby
Author-email: web-sig@python.org Author-email: web-sig@python.org
......
...@@ -473,3 +473,20 @@ class CGIHandler(BaseCGIHandler): ...@@ -473,3 +473,20 @@ class CGIHandler(BaseCGIHandler):
self, sys.stdin, sys.stdout, sys.stderr, dict(os.environ.items()), self, sys.stdin, sys.stdout, sys.stderr, dict(os.environ.items()),
multithread=False, multiprocess=True multithread=False, multiprocess=True
) )
#
...@@ -187,3 +187,19 @@ class Headers: ...@@ -187,3 +187,19 @@ class Headers:
else: else:
parts.append(_formatparam(k.replace('_', '-'), v)) parts.append(_formatparam(k.replace('_', '-'), v))
self._headers.append((_name, "; ".join(parts))) self._headers.append((_name, "; ".join(parts)))
#
...@@ -190,3 +190,16 @@ if __name__ == '__main__': ...@@ -190,3 +190,16 @@ if __name__ == '__main__':
import webbrowser import webbrowser
webbrowser.open('http://localhost:8000/xyz?abc') webbrowser.open('http://localhost:8000/xyz?abc')
httpd.handle_request() # serve one request, then exit httpd.handle_request() # serve one request, then exit
#
...@@ -171,3 +171,35 @@ _hoppish = { ...@@ -171,3 +171,35 @@ _hoppish = {
def is_hop_by_hop(header_name): def is_hop_by_hop(header_name):
"""Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header"""
return _hoppish(header_name.lower()) return _hoppish(header_name.lower())
#
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment