"Universal Gateway" (Was: Python, win32, COM, IDispatch, I<arbitrary> client query)

Mark Hammond mhammond at skippinet.com.au
Thu Oct 31 18:43:45 EST 2002


Paul Moore wrote:

> Unfortunately, the universal gateway stuff is hopelessly
> underdocumented (a couple of examples which don't even seem to work,
> plus the sources :-() 

Too true.  However, as the generated warning says, I was worried that 
stuff would change too much as the problem became clearer.

Fortunately, I'm now pretty happy with it.  In the lastest win32all 
versions you will find an Outlook Addin sample.  This uses the Universal 
Gateway code to implement a reasonable interface.

I have also recently done a little work to make implementing *every* 
interface in a type library must simpler, which will be very useful when 
Python can actually generate TLB files from your source, but even now is 
useful if you don't mind hand-writing the IDL file you want your Python 
components to implement.

So it seems there will be 2 universal strategies:
* If you want to implement one or 2 interfaces (eg, the Outlook addin, 
where you only need to implement a handful of interfaces out of the 
hundreds available) - in this case you stick with the 
"RegisterInterfaces()" type calls in the existing examples.

* You want to implement *all* interfaces in a TLB.  In this case you add 
a couple of extra annotations to your server class, and magic happens <wink>

So I am confident that the existing setup is reasonable (well, as 
reasonable as sticking GUIDs in your source ever can be)

If you want to play with Universal, get win32all 149 or 150, as it has a 
number of univeral related bugs fixed (and indeed the Outlook plugin 
will not work without it).  The plugin is in win32com\demos.

Mark.




More information about the Python-list mailing list