[omniORB] omniidl python backend is generating name-clashing code

Alexander Haarer alexander.haarer at atlas.de
Tue Oct 10 11:44:31 BST 2006


Hi ,

i want to use omniorbpy2 Python2.4 to generate code from an idl
containing Python reserved keywords.

There seems to be no mechanism that maps python reserved words with a
prefix (like for c++)

Is this a bug, or did i miss something in the documentation ? Is there a
workaround ?
(No, i cannot change the IDL)


This IDL

module TestMe
{
    enum TestEnum
    {
        Yes,
        No,
        None
    };
};

results in generated code like this:

# enum TestEnum
_0_TestMe.Yes = omniORB.EnumItem("Yes", 0)
_0_TestMe.No = omniORB.EnumItem("No", 1)
_0_TestMe.None = omniORB.EnumItem("None", 2)
_0_TestMe.TestEnum = omniORB.Enum("IDL:TestMe/TestEnum:1.0",
(_0_TestMe.Yes, _0_TestMe.No, _0_TestMe.None,))

which breaks on import:

>>> import TestMe
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "TestMe/__init__.py", line 6, in ?
    import TestMe_idl
  File "TestMe_idl.py", line 26
    _0_TestMe.None = omniORB.EnumItem("None", 2)
SyntaxError: assignment to None


tia




More information about the omniORB-list mailing list