You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2009/02/07 03:37:10 UTC

svn commit: r741833 - in /incubator/thrift/trunk: compiler/cpp/src/generate/t_py_generator.cc test/DebugProtoTest.thrift test/py/TestSyntax.py

Author: dreiss
Date: Sat Feb  7 02:37:09 2009
New Revision: 741833

URL: http://svn.apache.org/viewvc?rev=741833&view=rev
Log:
THRIFT-256. python: Fix inheritance of services in the same IDL file

The old version of type_name did not fully qualify parent service names
when they were defined in the same IDL file, but it is necessary because
they end up in different Python files.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
    incubator/thrift/trunk/test/DebugProtoTest.thrift
    incubator/thrift/trunk/test/py/TestSyntax.py

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc?rev=741833&r1=741832&r2=741833&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc Sat Feb  7 02:37:09 2009
@@ -1832,12 +1832,11 @@
 
 string t_py_generator::type_name(t_type* ttype) {
   t_program* program = ttype->get_program();
+  if (ttype->is_service()) {
+    return get_real_py_module(program) + "." + ttype->get_name();
+  }
   if (program != NULL && program != program_) {
-    if (ttype->is_service()) {
-      return get_real_py_module(program) + "." + ttype->get_name();
-    } else {
-      return get_real_py_module(program) + ".ttypes." + ttype->get_name();
-    }
+    return get_real_py_module(program) + ".ttypes." + ttype->get_name();
   }
   return ttype->get_name();
 }

Modified: incubator/thrift/trunk/test/DebugProtoTest.thrift
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/DebugProtoTest.thrift?rev=741833&r1=741832&r2=741833&view=diff
==============================================================================
--- incubator/thrift/trunk/test/DebugProtoTest.thrift (original)
+++ incubator/thrift/trunk/test/DebugProtoTest.thrift Sat Feb  7 02:37:09 2009
@@ -82,6 +82,10 @@
   i32 Janky(i32 arg)
 }
 
+service Inherited extends Srv {
+  i32 identity(i32 arg)
+}
+
 service EmptyService {}
 
 // The only purpose of this thing is to increase the size of the generated code

Modified: incubator/thrift/trunk/test/py/TestSyntax.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/py/TestSyntax.py?rev=741833&r1=741832&r2=741833&view=diff
==============================================================================
--- incubator/thrift/trunk/test/py/TestSyntax.py (original)
+++ incubator/thrift/trunk/test/py/TestSyntax.py Sat Feb  7 02:37:09 2009
@@ -6,3 +6,4 @@
 
 # Just import these generated files to make sure they are syntactically valid
 from DebugProtoTest import EmptyService
+from DebugProtoTest import Inherited