[omniORB] CORBA.TypeCode() on enum fails in omniorbpy
    Andrew Edem 
    andrew at kaxis.us
       
    Tue Jun  5 09:42:36 BST 2007
    
    
  
Hello,
It does not seem possible to use CORBA.TypeCode() on enum definitions
from stubs. I think this is because the python type of the enum
definition is an instance while omniORB expects it to be a class.
I'm not entirely sure if this is a bug or by design, and I have no idea
where the "right" place to fix it would be.
Thanks,
-Andrew
test.idl:
module Test {
  enum TestEnum {
    TEST_VALUE1,
    TEST_VALUE2
  };
};
test.py:
import Test
from omniORB import CORBA
import logging
print "Type of enum: ", `type(Test.TestEnum)`
try:
  print "Enum type code by object: ", `CORBA.TypeCode(Test.TestEnum)`
except:
  logging.exception("Getting type code by class failed")
try:
  print "Enum type code by string: ", \
    `CORBA.TypeCode("IDL:Test/TestEnum:1.0")`
except:
  logging.exception("Getting type code by string failed")
output:
Type of enum:  <type 'instance'>
ERROR:root:Getting type code by class failed
Traceback (most recent call last):
  File "test.py", line 8, in ?
    print "Enum type code by object: ", `CORBA.TypeCode(Test.TestEnum)`
  File "/usr/lib/python2.4/site-packages/omniORB/CORBA.py", line 405, in
__init__
    self._t = tcInternal.typeCodeFromClassOrRepoId(cr)
  File "/usr/lib/python2.4/site-packages/omniORB/tcInternal.py", line
192, in typeCodeFromClassOrRepoId
    raise TypeError("Argument must be CORBA class or repository id.")
TypeError: Argument must be CORBA class or repository id.
Enum type code by string:  CORBA.TypeCode("IDL:Test/TestEnum:1.0")
    
    
More information about the omniORB-list
mailing list