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/TestServer.py b/test/py/TestServer.py
new file mode 100755
index 0000000..4b571c7
--- /dev/null
+++ b/test/py/TestServer.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+import sys
+sys.path.append('./gen-py')
+
+import ThriftTest
+from ThriftTest_types import *
+from thrift.transport import TSocket
+from thrift.protocol import TBinaryProtocol
+from thrift.server import TServer
+
+class TestHandler:
+
+ def testVoid(self):
+ print 'testVoid()'
+
+ def testString(self, str):
+ print 'testString(%s)' % str
+ return str
+
+ def testByte(self, byte):
+ print 'testByte(%d)' % byte
+ return byte
+
+ def testException(self, str):
+ print 'testException(%s)' % str
+ x = Xception()
+ x.errorCode = 1001
+ x.message = str
+ raise x
+
+transport = TSocket.TServerSocket(9090)
+protocol = TBinaryProtocol.TBinaryProtocol()
+handler = TestHandler()
+iface = ThriftTest.Server(handler, protocol)
+server = TServer.TSimpleServer(iface, transport)
+server.run()