[pywin32-checkins] pywin32/com/win32com/server util.py,1.3,1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-11-24 09:28:13
|
Update of /cvsroot/pywin32/pywin32/com/win32com/server In directory sc8-pr-cvs1:/tmp/cvs-serv11002 Modified Files: util.py Log Message: Allow the enumerator class to implement any nominated interface, and to allow debugging. Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/util.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** util.py 8 Nov 2003 00:37:32 -0000 1.3 --- util.py 24 Nov 2003 09:28:10 -0000 1.4 *************** *** 55,64 **** """ _public_methods_ = [ 'Next', 'Skip', 'Reset', 'Clone' ] - _com_interfaces_ = [ pythoncom.IID_IEnumVARIANT ] ! def __init__(self, data, index=0): self._list_ = data self.index = index def Next(self, count): result = self._list_[self.index:self.index+count] --- 55,67 ---- """ _public_methods_ = [ 'Next', 'Skip', 'Reset', 'Clone' ] ! def __init__(self, data, index=0, iid = pythoncom.IID_IEnumVARIANT): self._list_ = data self.index = index + self._iid_ = iid + def _query_interface_(self, iid): + if iid == self._iid_: + return 1 def Next(self, count): result = self._list_[self.index:self.index+count] *************** *** 98,102 **** ! def NewEnum(seq, cls=ListEnumerator): """Creates a new enumerator COM server. --- 101,109 ---- ! def NewEnum(seq, ! cls=ListEnumerator, ! iid=pythoncom.IID_IEnumVARIANT, ! usePolicy=None, ! useDispatcher=None): """Creates a new enumerator COM server. *************** *** 107,115 **** created, then wrapped up for return through the COM framework. Optionally, a custom COM server for enumeration can be passed ! (the default is @ListEnumerator@). """ ! return pythoncom.WrapObject(policy.DefaultPolicy(cls(seq)), ! pythoncom.IID_IEnumVARIANT, ! pythoncom.IID_IEnumVARIANT) --- 114,122 ---- created, then wrapped up for return through the COM framework. Optionally, a custom COM server for enumeration can be passed ! (the default is @ListEnumerator@), and the specific IEnum ! interface can be specified. """ ! ob = cls(seq, iid=iid) ! return wrap(ob, iid, usePolicy=usePolicy, useDispatcher=useDispatcher) |