[omniORB] Attribute Error In IDL Generated Module

Steffen Ries steffen.ries@sympatico.ca
18 Mar 2001 09:40:49 -0500


jiwils - Jimmy Wilson <jiwils@acxiom.com> writes:

> When importing the Test module below, I get an attribute error.  The
> attribute error's location is the module generated by omniidl for Test.IDL.
> I think that the problem might have something to do with the fact that I
> have objects declared in my interface module space, but I would like to
> confirm that what I am seeing is truly a problem.

I have the impression that omniidl generates the wrong code for
typedefs inside interfaces.

The generated code looks like this:
class TheInterface:
  class TheStruct:
    ...
  class TheTypedef(_Module_prefix_.TheInterface.TheStruct):
    ...

At this point _Module_prefix_.TheInterface is not defined, but
"TheStruct" is, and it is in the current scope.

i.e. "class TheTypedef(TheStruct):" would define the typedef'ed name
without problems.

The following patch changes omniidl to generate the code this way.

--- lib/python/omniidl_be/python.py.org Sun Mar 18 08:29:54 2001
+++ lib/python/omniidl_be/python.py     Sun Mar 18 08:48:59 2001
@@ -994,8 +994,7 @@
                    unaliased_type.kind() in [idltype.tk_struct,
                                              idltype.tk_union]:
 
-                    parent = dotName(fixupScopedName(unaliased_type.decl().\
-                                                     scopedName()))
+                    parent = unaliased_type.decl().scopedName()[-1]
 
                     self.st.out(typedef_struct_union_header,
                                 tdname = tdname,

Disclaimer: This is the first time I actually looked into the code of
omniidl. So, don't trust me! :-)

> Since omniORBpy 1.2 has a problem with objects in interface module
> spaces, I've upgraded to omniORBpy 1.3 without success.  If this is
> a true problem, is there an appropriate workaround?

I think a good workaround would be to not use typedef at this point.

"struct x ..." already defines a name "x", with the typedef you are
creating just another name for the same thing. 

> Would moving the IDL objects outside of the interface module space
> be an appropriate fix?  I've attached the files mentioned above as
> well as the attribute error I am getting.  Any help will be greatly
> appreciated.

hth,
/steffen
-- 
steffen.ries@sympatico.ca	<> Gravity is a myth -- the Earth sucks!