[omniORB] omniORBpy: Problem with enumerations
Sebastian Rittau
srittau at jroger.in-berlin.de
Tue Jan 6 16:03:16 GMT 2004
On Tue, Jan 06, 2004 at 02:08:44PM +0000, Duncan Grisby wrote:
> I haven't tried the code, but I assume the problem is that the same
> IDL is dynamically imported more than once. That causes the enum
> objects used in the different modules to be different objects, so when
> omniORB is checking that a value is one of the possible enum items, it
> doesn't match. There's no sensible way to avoid the problem, other
> than to say not to use importIDL on the same file more than once. If
> you used omniidl separately and did a normal Python import, it would
> work fine.
I just tested this by removing the importIDL stuff from enumobjimpl.py
and just calling importIDL from server1.py and it works like a charm.
How does omniORB check whether the enum value is valid? Doesn't it use
the value from EnumItem._v? I personally I think that it would be nice
to "fix" this. While I agree that it's generally better to just call
importIDL once in a program (and this is how I'm changing my program
now), it might be unavoidable to call it multiple times in certain
circumstance, e.g. when using multiple modules that all want to parse
the same IDL file for some reason.
Anyway, I would suggest to document this issue in the section about
Dynamic importing of IDL in the omniORBpy manual. Something along the
lines of "Avoid importing the same IDL twice."
- Sebastian
More information about the omniORB-list
mailing list