Update of /cvsroot/pywin32/pywin32/com/win32com/server
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2167/server
Modified Files:
policy.py
Log Message:
* Allow _com_interfaces_ to be IIDs *and* interface names from a typelib.
Previously you could not mix and match
* Allow IID-like strings to be specified in _com_interfaces_
* Raise a value error when an invalid interface name is passed for
registration
* Tests
Index: policy.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/policy.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** policy.py 13 Feb 2005 12:09:35 -0000 1.20
--- policy.py 8 Jun 2005 05:19:03 -0000 1.21
***************
*** 246,249 ****
--- 246,251 ----
if i[0] != "{":
i = pythoncom.InterfaceNames[i]
+ else:
+ i = pythoncom.MakeIID(i)
self._com_interfaces_.append(i)
else:
***************
*** 464,468 ****
tlb_lcid = getattr(ob, '_typelib_lcid_', 0)
from win32com import universal
! interfaces = getattr(ob, '_com_interfaces_', None)
universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid,
tlb_major, tlb_minor, interfaces)
--- 466,474 ----
tlb_lcid = getattr(ob, '_typelib_lcid_', 0)
from win32com import universal
! # XXX - what if the user wants to implement interfaces from multiple
! # typelibs?
! # Filter out all 'normal' IIDs (ie, IID objects and strings starting with {
! interfaces = [i for i in getattr(ob, '_com_interfaces_', [])
! if type(i) != pythoncom.PyIIDType and not i.startswith("{")]
universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid,
tlb_major, tlb_minor, interfaces)
***************
*** 537,541 ****
try:
type_info, type_comp = typecomp.BindType(iname)
! return [type_info]
except pythoncom.com_error:
pass
--- 543,548 ----
try:
type_info, type_comp = typecomp.BindType(iname)
! if type_info is not None:
! return [type_info]
except pythoncom.com_error:
pass
|