[omniORB] Attribute Error In IDL Generated Module
Duncan Grisby
dgrisby@uk.research.att.com
Mon, 19 Mar 2001 12:06:32 +0000
On Saturday 17 March, jiwils - Jimmy Wilson wrote:
[...]
> 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.
There is indeed a bug in omniidl (well, the Python back-end). Steffen
Ries correctly diagnosed the problem, but his fix breaks other
situations. I've checked in a full fix. The patch is small so it's at
the end. You can also get it from the normal channels -- CVS, nightly
snapshots, bugfixes patch.
As Steffen said, it's best to avoid doing typedef struct ... anyway,
since it's completely redundant in IDL.
Cheers,
Duncan.
--- src/lib/omniORBpy/omniidl_be/python.py 2000/11/01 11:25:56 1.27.2.4
+++ src/lib/omniORBpy/omniidl_be/python.py 2001/03/19 11:51:16
@@ -994,8 +994,19 @@
unaliased_type.kind() in [idltype.tk_struct,
idltype.tk_union]:
- parent = dotName(fixupScopedName(unaliased_type.decl().\
- scopedName()))
+ psname = unaliased_type.decl().scopedName()
+ myscope = decl.scopedName()[:-1]
+
+ # If the struct/union definition is in the same
+ # scope as the typedef, we must use a relative
+ # name to refer to the parent class, since the
+ # enclosing Python class has not yet been fully
+ # defined.
+
+ if psname[:len(myscope)] == myscope:
+ parent = dotName(psname[len(myscope):])
+ else:
+ parent = dotName(fixupScopedName(psname))
self.st.out(typedef_struct_union_header,
tdname = tdname,
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --