Thrift Python server code generation

Summary: Yep, it's up and running. We now have full client/server support in all of C++ Java PHP and Python. Well, not quite... there's no PHP server, but honestly who wants one? Actually, if we do want one the framework will support writing is as a PHP file that can be served in apache like a web service (i.e. restserver.php would be thriftserver.php). But now that's rambling and nothing to do with this commit.

Notes: cheever, let's chat about porting your multithreaded Pillar Python server over to Thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664783 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/py/TestClient.py b/test/py/TestClient.py
index a64b8d7..21d1990 100755
--- a/test/py/TestClient.py
+++ b/test/py/TestClient.py
@@ -5,31 +5,56 @@
 
 import ThriftTest
 from ThriftTest_types import *
+from thrift.transport import TTransport
 from thrift.transport import TSocket
 from thrift.protocol import TBinaryProtocol
 
-transport = TSocket.TSocket('localhost', 9090)
+import timing
+
+transport = TTransport.TBufferedTransport(TSocket.TSocket('localhost', 9090))
 protocol = TBinaryProtocol.TBinaryProtocol()
 client = ThriftTest.Client(transport, protocol)
 
 transport.open()
 
+# Start debug timing
+timing.start()
+
 print "testVoid()"
 print client.testVoid()
 
-print "testString('PythonTest')"
-print client.testString('PythonTest')
+print "testString('Python')"
+print client.testString('Python')
 
 print "testByte(63)"
 print client.testByte(63)
 
+print "testI32(-1)"
+print client.testI32(-1)
+
+print "testI64(-34359738368)"
+print client.testI64(-34359738368)
+
+print "testStruct({Zero, 1, -3, -5})"
+x = Xtruct()
+x.string_thing = "Zero"
+x.byte_thing = 1
+x.i32_thing = -3
+x.i64_thing = -5
+x = client.testStruct(x)
+print "{%s, %d, %d, %d}" % (x.string_thing, x.byte_thing, x.i32_thing, x.i64_thing)
+
 print "testException('Safe')"
 print client.testException('Safe')
 
-print "textException('Xception')"
 try:
+  print "textException('Xception')"
   print client.testException('Xception')
+
 except Xception, x:
-  print 'Xception (%d, %s)' % (x.errorCode, x.message)
+  print "Xception (%d, %s)" % (x.errorCode, x.message)
+
+timing.finish()
+print "Total time: %d microsecs" % timing.micro()
 
 transport.close()