You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jonathan Kupferman (JIRA)" <ji...@apache.org> on 2009/05/21 23:23:45 UTC
[jira] Updated: (THRIFT-515) Having the same namespace in separate
thrift files generates non-working code
[ https://issues.apache.org/jira/browse/THRIFT-515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Kupferman updated THRIFT-515:
--------------------------------------
Summary: Having the same namespace in separate thrift files generates non-working code (was: Having the same namespace in separate thrift files generates )
> Having the same namespace in separate thrift files generates non-working code
> -----------------------------------------------------------------------------
>
> Key: THRIFT-515
> URL: https://issues.apache.org/jira/browse/THRIFT-515
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (Python)
> Reporter: Jonathan Kupferman
> Priority: Minor
>
> If there are two thrift files which use the same namespace the generated python code does not work. A sample case is the two thrift files provided below:
> --------test.thrift----------
> namespace py Sample
> struct Name {
> 1: string n
> }
> struct User {
> 1: i32 id,
> 2: Name user_name
> }
> -------- end test.thrift----------
> --------test_service.thrift-----------
> include "test.thrift"
> namespace py Sample
> service TestService {
> test.User get_user(1: i64 id),
> test.Name get_user_name(1: i64 id),
> }
> --------end test_service.thrift-----------
> This happens because the ttypes for test.thrift are clobbered by the ttypes for TestService. As a result TestService is not imported correctly.
> >>> import Sample
> >>> import Sample.ttypes
> >>> from Sample import *
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "Sample/TestService.py", line 205, in <module>
> class get_user_result:
> File "Sample/TestService.py", line 212, in get_user_result
> (0, TType.STRUCT, 'success', (Sample.ttypes.User, Sample.ttypes.User.thrift_spec), None, ), # 0
> AttributeError: 'module' object has no attribute 'User'
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.