Permalink
Browse files

make test printer more correct (print was inserting newlines)

  • Loading branch information...
mnot committed Sep 8, 2010
1 parent e05a3ac commit 1aa908026bcb7aa1b640e678e4b6be6f3c83a036
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/client.py
View
@@ -380,16 +380,20 @@ def idle_close():
def test_client(request_uri):
"A simple demonstration of a client."
+ import sys
+
def printer(version, status, phrase, headers, res_pause):
"Print the response headers."
print "HTTP/%s" % version, status, phrase
print "\n".join(["%s:%s" % header for header in headers])
print
def body(chunk):
- print chunk
+ sys.stdout.write(chunk)
def done(err):
if err:
- print "*** ERROR: %s (%s)" % (err['desc'], err['detail'])
+ sys.stderr.write("\n*** ERROR: %s (%s)\n" %
+ (err['desc'], err['detail'])
+ )
push_tcp.stop()
return body, done
c = Client(printer)

0 comments on commit 1aa9080

Please sign in to comment.