[pywin32-checkins] pywin32/com/win32com/client __init__.py,1.30,1.31
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-23 15:18:57
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv29281 Modified Files: __init__.py Log Message: Add _get_good_object_ etc as module level functions so everyone can use them, not just IDispatch wrappers. Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/__init__.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** __init__.py 2 Sep 2003 00:09:41 -0000 1.30 --- __init__.py 23 Oct 2003 07:12:02 -0000 1.31 *************** *** 458,477 **** raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) self._oleobj_.Invoke(*(args + (value,) + defArgs)) - # XXX - These should be consolidated with dynamic.py versions. def _get_good_single_object_(self, obj, obUserName=None, resultCLSID=None): ! if _PyIDispatchType==type(obj): ! return Dispatch(obj, obUserName, resultCLSID, UnicodeToString=NeedUnicodeConversions) ! elif NeedUnicodeConversions and UnicodeType==type(obj): ! return str(obj) ! return obj def _get_good_object_(self, obj, obUserName=None, resultCLSID=None): ! if obj is None: ! return None ! elif type(obj)==TupleType: ! obUserNameTuple = (obUserName,) * len(obj) ! resultCLSIDTuple = (resultCLSID,) * len(obj) ! return tuple(map(self._get_good_object_, obj, obUserNameTuple, resultCLSIDTuple)) ! else: ! return self._get_good_single_object_(obj, obUserName, resultCLSID) class CoClassBaseClass: --- 458,483 ---- raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) self._oleobj_.Invoke(*(args + (value,) + defArgs)) def _get_good_single_object_(self, obj, obUserName=None, resultCLSID=None): ! return _get_good_single_object_(obj, obUserName, resultCLSID) def _get_good_object_(self, obj, obUserName=None, resultCLSID=None): ! return _get_good_object_(obj, obUserName, resultCLSID) ! ! # XXX - These should be consolidated with dynamic.py versions. ! def _get_good_single_object_(obj, obUserName=None, resultCLSID=None): ! if _PyIDispatchType==type(obj): ! return Dispatch(obj, obUserName, resultCLSID, UnicodeToString=NeedUnicodeConversions) ! elif NeedUnicodeConversions and UnicodeType==type(obj): ! return str(obj) ! return obj ! ! def _get_good_object_(obj, obUserName=None, resultCLSID=None): ! if obj is None: ! return None ! elif type(obj)==TupleType: ! obUserNameTuple = (obUserName,) * len(obj) ! resultCLSIDTuple = (resultCLSID,) * len(obj) ! return tuple(map(_get_good_object_, obj, obUserNameTuple, resultCLSIDTuple)) ! else: ! return _get_good_single_object_(obj, obUserName, resultCLSID) class CoClassBaseClass: |