pywin32-checkins Mailing List for Python for Windows Extensions (Page 150)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <mha...@us...> - 2003-10-25 05:37:55
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1:/tmp/cvs-serv10858 Modified Files: win32dc.cpp Log Message: Add documentation contributed by Chris Wren. Index: win32dc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dc.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win32dc.cpp 27 Nov 1999 08:01:08 -0000 1.2 --- win32dc.cpp 25 Oct 2003 05:32:20 -0000 1.3 *************** *** 2191,2203 **** UINT nFormat=DT_SINGLELINE|DT_CENTER|DT_VCENTER; if (!PyArg_ParseTuple(args, ! "s(iiii)|i",&psz, ! &rect.left,&rect.top, ! &rect.right,&rect.bottom,&nFormat)) return NULL; CString str(psz); int height=pDC->DrawText(str,&rect,nFormat); ! return Py_BuildValue("i",height); } --- 2191,2231 ---- UINT nFormat=DT_SINGLELINE|DT_CENTER|DT_VCENTER; if (!PyArg_ParseTuple(args, ! "s(iiii)|i",&psz, // @pyparm string|s||The desired output string ! // @pyparm (int, int, int, int)|tuple||The bounding rectangle in the form: ! // (left, top, right, bottom) expressed in logical units (depending on ! // selected coordinate system - see <om PyCDC.SetMapMode>) ! &rect.left,&rect.top, ! &rect.right,&rect.bottom, ! // @pyparm int|format||Specifies one or more bit-or'd format values, such as ! // DT_BOTTOM, DT_CENTERDT_RIGHT, DT_VCENTER. For a complete list, see ! // the Microsoft Win32 API documentation. ! &nFormat)) return NULL; CString str(psz); int height=pDC->DrawText(str,&rect,nFormat); ! // @rdesc The return value is the height of the text, in logical units. ! // If DT_VCENTER or DT_BOTTOM is specified, the return value is the ! // offset from rect.top to the bottom of the drawn text. ! // If the function fails, the return value is zero (no Python exception is thrown) return Py_BuildValue("i",height); + // @ex Example|import win32ui<nl> + // import win32con<nl> + // INCH = 1440 # twips - 1440 per inch allows fine res<nl> + // def drawtext_test():<nl> + // dc = win32ui.CreateDC()<nl> + // dc.CreatePrinterDC() # ties to default printer<nl> + // dc.StartDoc('My Python Document')<nl> + // dc.StartPage()<nl> + // <nl> + // # note: upper left is 0,0 with x increasing to the right,<nl> + // # and y decreasing (negative) moving down<nl> + // dc.SetMapMode(win32con.MM_TWIPS)<nl> + // <nl> + // # Centers "TEST" about an inch down on page<nl> + // dc.DrawText('TEST', (0,INCH*-1,INCH*8,INCH*-2), win32con.DT_CENTER )<nl> + // dc.EndPage()<nl> + // dc.EndDoc()<nl> + // del dc<nl> } |
From: <mha...@us...> - 2003-10-24 23:26:37
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv21753 Modified Files: oleargs.cpp Log Message: If __len__ failed when filling a SafeArray, this exception was left pending, and Python would complain with "XXX - undetected error" Index: oleargs.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** oleargs.cpp 20 Oct 2003 04:48:26 -0000 1.22 --- oleargs.cpp 24 Oct 2003 04:26:21 -0000 1.23 *************** *** 473,486 **** // Allow arbitary sequences, but not strings or Unicode objects. while (obItemCheck && PySequence_Check(obItemCheck) && !PyString_Check(obItemCheck) && !PyUnicode_Check(obItemCheck)) { ! if (!PyBuffer_Check(obItemCheck) && PySequence_Length(obItemCheck)) { ! PyObject *obSave = obItemCheck; ! obItemCheck = PySequence_GetItem(obItemCheck,0); ! Py_DECREF(obSave); ! if (obItemCheck==NULL) { ! // Says it is a sequence, but getting the item failed. ! // (eg, may be a COM instance that has __getitem__, but fails when attempting) ! // Ignore the error, and pretend it is not a sequence. PyErr_Clear(); break; } } else { --- 473,498 ---- // Allow arbitary sequences, but not strings or Unicode objects. while (obItemCheck && PySequence_Check(obItemCheck) && !PyString_Check(obItemCheck) && !PyUnicode_Check(obItemCheck)) { ! if (!PyBuffer_Check(obItemCheck) ) { ! // We *think* it is a sequence, but may not be. (eg, maybe ! // a COM instance with __len__/__getitem__, but they will fail. ! // In these cases, ignore the error and pretend it is not a sequence. ! int sub_len = PySequence_Length(obItemCheck); ! if (sub_len<0) { // __len__ failed. PyErr_Clear(); break; + } + if (sub_len) { + // The reckon we have at least one item - fetch it. + // XXX - is this really necessary? Isn't __len__ failure + // good enough? + PyObject *obSave = obItemCheck; + obItemCheck = PySequence_GetItem(obItemCheck,0); + + Py_DECREF(obSave); + if (obItemCheck==NULL) { + // getting the item failed. + PyErr_Clear(); + break; + } } } else { |
From: <mha...@us...> - 2003-10-24 18:22:49
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv22892 Modified Files: PyWin32.kpf Log Message: Komodo project changes. Index: PyWin32.kpf =================================================================== RCS file: /cvsroot/pywin32/pywin32/PyWin32.kpf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyWin32.kpf 15 Oct 2003 04:30:21 -0000 1.1 --- PyWin32.kpf 24 Oct 2003 04:48:56 -0000 1.2 *************** *** 3,8 **** <project kpf_version="2" name="PyWin32"> <preference-set id=""> - <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;*.dsp</string> <string id="import_dirname">E:\src\pythonex</string> <string id="import_include_matches">*.c;*.cpp;*.h;*.def;*.mc;*.py;*.bat;*.txt;*.vbs;*.js;*.x*;*.i;</string> </preference-set> --- 3,8 ---- <project kpf_version="2" name="PyWin32"> <preference-set id=""> <string id="import_dirname">E:\src\pythonex</string> + <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;*.dsp</string> <string id="import_include_matches">*.c;*.cpp;*.h;*.def;*.mc;*.py;*.bat;*.txt;*.vbs;*.js;*.x*;*.i;</string> </preference-set> *************** *** 14,17 **** --- 14,19 ---- </file> <folder name="com" url="com"> + <preference-set id=""> + </preference-set> <file name="changes.txt" url="com/changes.txt"> </file> *************** *** 45,48 **** --- 47,52 ---- </folder> <folder name="win32com" url="com/win32com"> + <preference-set id=""> + </preference-set> <file name="changes.txt" url="com/win32com/changes.txt"> </file> *************** *** 372,375 **** --- 376,381 ---- </folder> <folder name="test" url="com/win32com/test"> + <preference-set id=""> + </preference-set> <file name="daodump.py" url="com/win32com/test/daodump.py"> </file> *************** *** 428,434 **** <file name="testStreams.py" url="com/win32com/test/testStreams.py"> </file> - <file name="testuniv.py" url="com/win32com/test/testuniv.py"> - </file> <file name="testvb.py" url="com/win32com/test/testvb.py"> </file> <file name="testWMI.py" url="com/win32com/test/testWMI.py"> --- 434,459 ---- <file name="testStreams.py" url="com/win32com/test/testStreams.py"> </file> <file name="testvb.py" url="com/win32com/test/testvb.py"> + <preference-set id=""> + <preference-set id="Invocations"> + <preference-set id="Python"> + <string id="postparams"></string> + <string id="userEnvironment"></string> + <string id="getparams"></string> + <boolean id="use-console">0</boolean> + <string id="mpostparams"></string> + <boolean id="show-dialog">1</boolean> + <string id="request-method">GET</string> + <string id="params"></string> + <string id="userCGIEnvironment"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="documentRoot"></string> + <string id="cookieparams"></string> + <string id="filename">E:\src\pythonex\com\win32com\test\testvb.py</string> + <boolean id="sim-cgi">0</boolean> + <string id="cwd"></string> + </preference-set> + </preference-set> + </preference-set> </file> <file name="testWMI.py" url="com/win32com/test/testWMI.py"> *************** *** 444,447 **** --- 469,474 ---- <file name="__init__.py" url="com/win32com/test/__init__.py"> </file> + <file name="testIterators.py" url="com/win32com/test/testIterators.py"> + </file> </folder> </folder> *************** *** 1629,1639 **** <preference-set id="Invocations"> <preference-set id="Python"> - <string id="userEnvironment"></string> <string id="postparams"></string> <string id="getparams"></string> <boolean id="use-console">0</boolean> - <string id="mpostparams"></string> - <boolean id="sim-cgi">0</boolean> <string id="filename">E:\src\pythonex\win32\Demos\win32gui_menu.py</string> <string id="request-method">GET</string> <string id="params"></string> --- 1656,1665 ---- <preference-set id="Invocations"> <preference-set id="Python"> <string id="postparams"></string> <string id="getparams"></string> <boolean id="use-console">0</boolean> <string id="filename">E:\src\pythonex\win32\Demos\win32gui_menu.py</string> + <string id="mpostparams"></string> + <boolean id="show-dialog">1</boolean> <string id="request-method">GET</string> <string id="params"></string> *************** *** 1642,1646 **** <string id="documentRoot"></string> <string id="cookieparams"></string> ! <boolean id="show-dialog">1</boolean> <string id="cwd"></string> </preference-set> --- 1668,1673 ---- <string id="documentRoot"></string> <string id="cookieparams"></string> ! <string id="userEnvironment"></string> ! <boolean id="sim-cgi">0</boolean> <string id="cwd"></string> </preference-set> *************** *** 1892,1895 **** --- 1919,1924 ---- </folder> <folder name="test" url="win32/test"> + <preference-set id=""> + </preference-set> <file name="handles.py" url="win32/test/handles.py"> </file> *************** *** 1907,1910 **** --- 1936,1962 ---- </file> <file name="test_win32wnet.py" url="win32/test/test_win32wnet.py"> + </file> + <file name="testall.py" url="win32/test/testall.py"> + <preference-set id=""> + <preference-set id="Invocations"> + <preference-set id="Python"> + <string id="userEnvironment"></string> + <string id="postparams"></string> + <string id="getparams"></string> + <boolean id="use-console">0</boolean> + <string id="mpostparams"></string> + <boolean id="sim-cgi">0</boolean> + <string id="filename">E:\src\pythonex\win32\test\testall.py</string> + <string id="request-method">GET</string> + <string id="params"></string> + <string id="userCGIEnvironment"></string> + <string id="posttype">application/x-www-form-urlencoded</string> + <string id="documentRoot"></string> + <string id="cookieparams"></string> + <boolean id="show-dialog">1</boolean> + <string id="cwd"></string> + </preference-set> + </preference-set> + </preference-set> </file> </folder> |
From: <mha...@us...> - 2003-10-24 17:31:05
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv911 Modified Files: genpy.py Log Message: Patch from Kenny Pitt - when looking for an interface member, compare the "public" name of the member, as that is what we will be asking for (ie, the raw name of "Exception" will become EXCEPTION) Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** genpy.py 23 Oct 2003 07:19:15 -0000 1.34 --- genpy.py 23 Oct 2003 22:51:08 -0000 1.35 *************** *** 917,925 **** if infotype == pythoncom.TKIND_COCLASS: coClassItem, child_infos = self._Build_CoClass(type_info_tuple) ! found = doc[0]==child if not found: # OK, check the child interfaces for info, info_type, refType, doc, refAttr, flags in child_infos: ! if doc[0] == child: found = 1 break --- 917,925 ---- if infotype == pythoncom.TKIND_COCLASS: coClassItem, child_infos = self._Build_CoClass(type_info_tuple) ! found = build.MakePublicAttributeName(doc[0])==child if not found: # OK, check the child interfaces for info, info_type, refType, doc, refAttr, flags in child_infos: ! if build.MakePublicAttributeName(doc[0]) == child: found = 1 break *************** *** 933,937 **** info, infotype, doc, attr = type_info_tuple if infotype in [pythoncom.TKIND_INTERFACE, pythoncom.TKIND_DISPATCH]: ! if doc[0]==child: found = 1 oleItem, vtableItem = self._Build_Interface(type_info_tuple) --- 933,937 ---- info, infotype, doc, attr = type_info_tuple if infotype in [pythoncom.TKIND_INTERFACE, pythoncom.TKIND_DISPATCH]: ! if build.MakePublicAttributeName(doc[0]) == child: found = 1 oleItem, vtableItem = self._Build_Interface(type_info_tuple) |
From: <mha...@us...> - 2003-10-24 17:09:42
|
Update of /cvsroot/pywin32/pywin32/win32/scripts/VersionStamp In directory sc8-pr-cvs1:/tmp/cvs-serv10733 Modified Files: bulkstamp.py verstamp.py Log Message: Pass is_dll around correctly in an attempt to make version stampting work on our .exe's - it didn't help, but this seems correct anyway :) Index: bulkstamp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/VersionStamp/bulkstamp.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bulkstamp.py 4 Jul 2003 12:14:30 -0000 1.5 --- bulkstamp.py 24 Oct 2003 07:06:24 -0000 1.6 *************** *** 59,67 **** if base[-2:]=='_d': name = base[:-2] + ext ! is_dll = 1 ### do something real, someday if descriptions.has_key(os.path.normcase(name)): desc = descriptions[os.path.normcase(name)] try: ! verstamp.stamp(vars, pathname, desc) numStamped = numStamped + 1 except win32api.error, (hr, func, desc): --- 59,67 ---- if base[-2:]=='_d': name = base[:-2] + ext ! is_dll = ext.lower() != ".exe" if descriptions.has_key(os.path.normcase(name)): desc = descriptions[os.path.normcase(name)] try: ! verstamp.stamp(vars, pathname, desc, is_dll=is_dll) numStamped = numStamped + 1 except win32api.error, (hr, func, desc): Index: verstamp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/VersionStamp/verstamp.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** verstamp.py 3 Apr 2000 11:39:20 -0000 1.3 --- verstamp.py 24 Oct 2003 07:06:25 -0000 1.4 *************** *** 129,133 **** return addlen(result) ! def stamp(vars, pathname, desc, verbose=0, is_dll=1): # For some reason, the API functions report success if the file is open # but doesnt work! Try and open the file for writing, just to see if it is --- 129,133 ---- return addlen(result) ! def stamp(vars, pathname, desc, verbose=0, debug=0, is_dll=1): # For some reason, the API functions report success if the file is open # but doesnt work! Try and open the file for writing, just to see if it is *************** *** 171,175 **** 'Translation' : struct.pack('hh', 0x409, 1200), } ! vs = VS_VERSION_INFO(maj, min, sub, build, sdata, vdata) h = BeginUpdateResource(pathname, 0) --- 171,175 ---- 'Translation' : struct.pack('hh', 0x409, 1200), } ! vs = VS_VERSION_INFO(maj, min, sub, build, sdata, vdata, debug, is_dll) h = BeginUpdateResource(pathname, 0) |
From: <mha...@us...> - 2003-10-24 16:50:05
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv25271/include Modified Files: PyIEnumVARIANT.h Log Message: Add support for the Python tp_iter slot for PyIEnumVARIANT Index: PyIEnumVARIANT.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumVARIANT.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIEnumVARIANT.h 5 May 2000 01:15:29 -0000 1.2 --- PyIEnumVARIANT.h 23 Oct 2003 02:43:04 -0000 1.3 *************** *** 12,15 **** --- 12,17 ---- static PyComTypeObject type; + virtual PyObject *iternext(); + // The Python methods static PyObject *Next(PyObject *self, PyObject *args); |
From: <mha...@us...> - 2003-10-24 13:28:57
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv28788 Modified Files: testvb.py Log Message: Beef up array tests to try and provoke various exceptions. Index: testvb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** testvb.py 23 Oct 2003 07:06:27 -0000 1.15 --- testvb.py 24 Oct 2003 05:28:32 -0000 1.16 *************** *** 28,31 **** --- 28,36 ---- import traceback + # for debugging + useDispatcher = None + ## import win32com.server.dispatcher + ## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher + error = "VB Test Error" *************** *** 89,118 **** raise error, "Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,) ! # Try and use a safe array (note that the VB code has this declared as a VARIANT ! # and I cant work out how to force it to use native arrays! ! # (NOTE Python will convert incoming arrays to tuples, so we pass a tuple, even tho ! # a list works fine - just makes it easier for us to compare the result! ! arrayData = tuple(range(1,100)) ! vbtest.ArrayProperty = arrayData ! if vbtest.ArrayProperty != arrayData: ! raise error, "Could not set the array data correctly - got back " + str(vbtest.ArrayProperty) ! # Floats ! arrayData = (1.0, 2.0, 3.0) ! vbtest.ArrayProperty = arrayData ! assert vbtest.ArrayProperty == arrayData, "Could not set the array data correctly - got back '%s'" % (vbtest.ArrayProperty,) ! # Strings. ! arrayData = tuple(string.split("Hello from Python")) ! vbtest.ArrayProperty = arrayData ! assert vbtest.ArrayProperty == arrayData, "Could not set the array data correctly - got back '%s'" % (vbtest.ArrayProperty,) ! # Date and Time? ! # COM objects. ! arrayData = (vbtest, vbtest) ! vbtest.ArrayProperty = arrayData ! assert vbtest.ArrayProperty == arrayData, "Could not set the array data correctly - got back '%s'" % (vbtest.ArrayProperty,) ! # Mixed ! arrayData = (1, 2.0, "3") ! vbtest.ArrayProperty = arrayData ! assert vbtest.ArrayProperty == arrayData, "Could not set the array data correctly - got back '%s'" % (vbtest.ArrayProperty,) ! TestStructs(vbtest) TestCollections(vbtest) --- 94,98 ---- raise error, "Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,) ! TestArrays(vbtest, bUseGenerated) TestStructs(vbtest) TestCollections(vbtest) *************** *** 134,173 **** # A "set" type property - only works for generated. ! print "Skipping CollectionProperty - how does VB recognize a collection object??" # vbtest.CollectionProperty = NewCollection((1,2,"3", "Four")) # if vbtest.CollectionProperty != (1,2,"3", "Four"): # raise error, "Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty) - # This one is a bit strange! The array param is "ByRef", as VB insists. - # The function itself also _returns_ the arram param. - # Therefore, Python sees _2_ result values - one for the result, - # and one for the byref. - testData = string.split("Mark was here") - resultData, byRefParam = vbtest.PassSAFEARRAY(testData) - # Un unicode everything (only 1.5.2) - try: - unicode - except NameError : # No builtin named Unicode! - resultData = map(str, resultData) - byRefParam = map(str, byRefParam) - if testData != list(resultData): - raise error, "The safe array data was not what we expected - got " + str(resultData) - if testData != list(byRefParam): - raise error, "The safe array data was not what we expected - got " + str(byRefParam) - testData = [1.0, 2.0, 3.0] - resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) - assert testData == list(byRefParam) - assert testData == list(resultData) - testData = ["hi", "from", "Python"] - resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) - assert testData == list(byRefParam), "Expected '%s', got '%s'" % (testData, list(byRefParam)) - assert testData == list(resultData), "Expected '%s', got '%s'" % (testData, list(resultData)) - # This time, instead of an explicit str() for 1.5, we just - # pass Unicode, so the result should compare equal - testData = [1, 2.0, pythoncom.Unicode("3")] - resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) - assert testData == list(byRefParam) - assert testData == list(resultData) - # These are sub's that have a single byref param # Result should be just the byref. --- 114,123 ---- # A "set" type property - only works for generated. ! # VB recognizes a collection via a few "private" interfaces that we ! # could later build support in for. # vbtest.CollectionProperty = NewCollection((1,2,"3", "Four")) # if vbtest.CollectionProperty != (1,2,"3", "Four"): # raise error, "Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty) # These are sub's that have a single byref param # Result should be just the byref. *************** *** 189,205 **** # Can't test IncrementVariantParam with the param omitted as it # it not declared in the VB code as "Optional" - useDispatcher = None - ## import win32com.server.dispatcher - ## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher callback_ob = wrap(TestObject(), useDispatcher = useDispatcher) vbtest.DoSomeCallbacks(callback_ob) - # Check we fail gracefully for byref safearray results with incorrect size. - print "Expecting a 'ValueError' exception to follow:" - try: - vbtest.DoCallbackSafeArraySizeFail(callback_ob) - except pythoncom.com_error, (hr, msg, exc, arg): - assert exc[1] == "Python COM Server Internal Error", "Didnt get the correct exception - '%s'" % (exc,) - ret = vbtest.PassIntByVal(1) if ret != 2: --- 139,145 ---- *************** *** 287,290 **** --- 227,324 ---- vbtest.EnumerableCollectionProperty.Add("3") _DoTestCollection(vbtest, "EnumerableCollectionProperty", [1,"Two", "3"]) + + def _DoTestArray(vbtest, data, expected_exception = None): + try: + vbtest.ArrayProperty = data + if expected_exception is not None: + raise error, "Expected '%s'" % expected_exception + except expected_exception: + return + got = vbtest.ArrayProperty + if got != data: + raise error, \ + "Could not set the array data correctly - got %r, expected %r" \ + % (got, data) + + def TestArrays(vbtest, bUseGenerated): + # Try and use a safe array (note that the VB code has this declared as a VARIANT + # and I cant work out how to force it to use native arrays! + # (NOTE Python will convert incoming arrays to tuples, so we pass a tuple, even tho + # a list works fine - just makes it easier for us to compare the result! + _DoTestArray(vbtest, tuple(range(1,100))) + # Floats + _DoTestArray(vbtest, (1.0, 2.0, 3.0)) + # Strings. + _DoTestArray(vbtest, tuple(string.split("Hello from Python"))) + # Date and Time? + # COM objects. + _DoTestArray(vbtest, (vbtest, vbtest)) + # Mixed + _DoTestArray(vbtest, (1, 2.0, "3")) + # Array alements containing other arrays + _DoTestArray(vbtest, (1,(vbtest, vbtest),("3","4"))) + # Multi-dimensional + _DoTestArray(vbtest, (( (1,2,3), (4,5,6) ))) + _DoTestArray(vbtest, (( (vbtest,vbtest,vbtest), (vbtest,vbtest,vbtest) ))) + # Another dimension! + arrayData = ( ((1,2),(3,4),(5,6)), ((7,8),(9,10),(11,12)) ) + arrayData = ( ((vbtest,vbtest),(vbtest,vbtest),(vbtest,vbtest)), + ((vbtest,vbtest),(vbtest,vbtest),(vbtest,vbtest)) ) + _DoTestArray(vbtest, arrayData) + + # Check that when a '__getitem__ that fails' object is the first item + # in the structure, we don't mistake it for a sequence. + _DoTestArray(vbtest, (vbtest, 2.0, "3")) + _DoTestArray(vbtest, (1, 2.0, vbtest)) + + # Pass bad data - first item wrong size + arrayData = ( ((1,2,1),(3,4),(5,6)), ((7,8),(9,10),(11,12)) ) + _DoTestArray(vbtest, arrayData, TypeError) + arrayData = ( ((vbtest,vbtest),), ((vbtest,),)) + _DoTestArray(vbtest, arrayData, TypeError) + # Pass bad data - last item wrong size + arrayData = ( ((1,2),(3,4),(5,6,8)), ((7,8),(9,10),(11,12)) ) + _DoTestArray(vbtest, arrayData, TypeError) + + # byref safearray results with incorrect size. + callback_ob = wrap(TestObject(), useDispatcher = useDispatcher) + print "** Expecting a 'ValueError' exception to be printed next:" + try: + vbtest.DoCallbackSafeArraySizeFail(callback_ob) + except pythoncom.com_error, (hr, msg, exc, arg): + assert exc[1] == "Python COM Server Internal Error", "Didnt get the correct exception - '%s'" % (exc,) + + if bUseGenerated: + # This one is a bit strange! The array param is "ByRef", as VB insists. + # The function itself also _returns_ the arram param. + # Therefore, Python sees _2_ result values - one for the result, + # and one for the byref. + testData = string.split("Mark was here") + resultData, byRefParam = vbtest.PassSAFEARRAY(testData) + # Un unicode everything (only 1.5.2) + try: + unicode + except NameError : # No builtin named Unicode! + resultData = map(str, resultData) + byRefParam = map(str, byRefParam) + if testData != list(resultData): + raise error, "The safe array data was not what we expected - got " + str(resultData) + if testData != list(byRefParam): + raise error, "The safe array data was not what we expected - got " + str(byRefParam) + testData = [1.0, 2.0, 3.0] + resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) + assert testData == list(byRefParam) + assert testData == list(resultData) + testData = ["hi", "from", "Python"] + resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) + assert testData == list(byRefParam), "Expected '%s', got '%s'" % (testData, list(byRefParam)) + assert testData == list(resultData), "Expected '%s', got '%s'" % (testData, list(resultData)) + # This time, instead of an explicit str() for 1.5, we just + # pass Unicode, so the result should compare equal + testData = [1, 2.0, pythoncom.Unicode("3")] + resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) + assert testData == list(byRefParam) + assert testData == list(resultData) + print "Array tests passed" def TestStructs(vbtest): |
From: <mha...@us...> - 2003-10-24 12:19:11
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv30450 Modified Files: test_win32file.py Log Message: Indicate the test is expected to fail on 2.2 Index: test_win32file.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32file.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_win32file.py 5 May 2003 01:01:00 -0000 1.1 --- test_win32file.py 24 Oct 2003 01:50:15 -0000 1.2 *************** *** 7,11 **** class TestSimpleOps(unittest.TestCase): def testSimpleFiles(self): ! fd, filename = tempfile.mkstemp() os.close(fd) os.unlink(filename) --- 7,14 ---- class TestSimpleOps(unittest.TestCase): def testSimpleFiles(self): ! try: ! fd, filename = tempfile.mkstemp() ! except AttributeError: ! self.fail("This test requires Python 2.3 or later") os.close(fd) os.unlink(filename) |
From: <mha...@us...> - 2003-10-24 11:38:42
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv9357 Modified Files: testIterators.py Log Message: Add better enumerator tests, and include a PythonCOM server as a test. Index: testIterators.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testIterators.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testIterators.py 23 Oct 2003 06:26:28 -0000 1.1 --- testIterators.py 23 Oct 2003 23:35:35 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- from win32com.client.gencache import EnsureDispatch + from win32com.client import Dispatch + import win32com.server.util import pythoncom *************** *** 16,39 **** def test_enumvariant_vb(self): ob, iter = self.iter_factory() ! num=0 for v in iter: ! num += 1 ! self.failUnless(num==self.expected_length, "didnt get the %d items (got %d)" % (self.expected_length, num)) def test_yield(self): ob, i = self.iter_factory() ! num=0 for v in yield_iter(iter(i)): ! num += 1 ! self.failUnless(num==self.expected_length, "didnt get the %d items (got %d)" % (self.expected_length, num)) ! def test_nonenum(self): try: ! for i in self.object: pass self.fail("Could iterate over a non-iterable object") except TypeError: pass # this is expected. ! self.assertRaises(TypeError, iter, self.object) ! self.assertRaises(AttributeError, getattr, self.object, "next") class VBTestCase(_BaseTestCase): --- 18,74 ---- def test_enumvariant_vb(self): ob, iter = self.iter_factory() ! got=[] for v in iter: ! got.append(v) ! self.assertEquals(got, self.expected_data) def test_yield(self): ob, i = self.iter_factory() ! got=[] for v in yield_iter(iter(i)): ! got.append(v) ! self.assertEquals(got, self.expected_data) ! def _do_test_nonenum(self, object): try: ! for i in object: pass self.fail("Could iterate over a non-iterable object") except TypeError: pass # this is expected. ! self.assertRaises(TypeError, iter, object) ! self.assertRaises(AttributeError, getattr, object, "next") ! ! def test_nonenum_wrapper(self): ! # Check our raw PyIDispatch ! ob = self.object._oleobj_ ! try: ! for i in ob: ! pass ! self.fail("Could iterate over a non-iterable object") ! except TypeError: ! pass # this is expected. ! self.assertRaises(TypeError, iter, ob) ! self.assertRaises(AttributeError, getattr, ob, "next") ! ! # And our Dispatch wrapper ! ob = self.object ! try: ! for i in ob: ! pass ! self.fail("Could iterate over a non-iterable object") ! except TypeError: ! pass # this is expected. ! # Note that as our object may be dynamic, we *do* have a __getitem__ ! # method, meaning we *can* call iter() on the object. In this case ! # actual iteration is what fails. ! # So either the 'iter(); will raise a type error, or an attempt to ! # fetch it ! try: ! iter(ob).next() ! self.fail("Expected a TypeError fetching this iterator") ! except TypeError: ! pass ! # And it should never have a 'next' method ! self.assertRaises(AttributeError, getattr, ob, "next") class VBTestCase(_BaseTestCase): *************** *** 42,48 **** # Our VB test harness exposes a property with IEnumVariant. ob = self.object.EnumerableCollectionProperty ! ob.Add(1) ! ob.Add("Two") ! ob.Add("3") # Get the raw IEnumVARIANT. invkind = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET --- 77,82 ---- # Our VB test harness exposes a property with IEnumVariant. ob = self.object.EnumerableCollectionProperty ! for i in self.expected_data: ! ob.Add(i) # Get the raw IEnumVARIANT. invkind = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET *************** *** 52,57 **** # don't get in the way of our tests. self.object = EnsureDispatch("PyCOMVBTest.Tester") self.iter_factory = factory - self.expected_length = 3 def tearDown(self): --- 86,117 ---- # don't get in the way of our tests. self.object = EnsureDispatch("PyCOMVBTest.Tester") + self.expected_data = [1, "Two", "3"] + self.iter_factory = factory + + def tearDown(self): + self.object = None + + # Test our client semantics, but using a wrapped Python list object. + # This has the effect of re-using our client specific tests, but in this + # case is exercising the server side. + class SomeObject: + _public_methods_ = ["GetCollection"] + def __init__(self, data): + self.data = data + def GetCollection(self): + return win32com.server.util.NewCollection(self.data) + + class WrappedPythonCOMServerTestCase(_BaseTestCase): + def setUp(self): + def factory(): + ob = self.object.GetCollection() + flags = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET + enum = ob._oleobj_.Invoke(pythoncom.DISPID_NEWENUM, 0, flags, 1) + return ob, enum.QueryInterface(pythoncom.IID_IEnumVARIANT) + + self.expected_data = [1,'Two',3] + sv = win32com.server.util.wrap(SomeObject(self.expected_data)) + self.object = Dispatch(sv) self.iter_factory = factory def tearDown(self): *************** *** 61,65 **** # We dont want our base class run suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(VBTestCase)) return suite --- 121,129 ---- # We dont want our base class run suite = unittest.TestSuite() ! for item in globals().values(): ! if type(item)==type(unittest.TestCase) and \ ! issubclass(item, unittest.TestCase) and \ ! item != _BaseTestCase: ! suite.addTest(unittest.makeSuite(item)) return suite |
From: <mha...@us...> - 2003-10-24 10:55:40
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv13324 Modified Files: test_security.py Log Message: Make a unittest test. Index: test_security.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_security.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_security.py 2 Sep 2003 00:16:23 -0000 1.1 --- test_security.py 23 Oct 2003 05:17:04 -0000 1.2 *************** *** 1,27 **** ! import win32api, win32con, win32security ! ! pwr_sid=win32security.LookupAccountName('','Power Users')[0] ! admin_sid=win32security.LookupAccountName('','Administrator')[0] ! sd=win32security.SECURITY_DESCRIPTOR() ! for x in xrange(0,100000): ! sd.SetSecurityDescriptorOwner(admin_sid,0) ! sd=win32security.SECURITY_DESCRIPTOR() ! for x in xrange(0,100000): ! sd.SetSecurityDescriptorGroup(pwr_sid,0) ! sd=win32security.SECURITY_DESCRIPTOR() ! dacl=win32security.ACL() ! dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_READ,pwr_sid) ! dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,admin_sid) ! for x in xrange(0,1000000): ! sd.SetSecurityDescriptorDacl(1,dacl,0) ! sd=win32security.SECURITY_DESCRIPTOR() ! sacl=win32security.ACL() ! sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.DELETE,admin_sid,1,1) ! sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,pwr_sid,1,1) ! for x in xrange(0,1000000): ! sd.SetSecurityDescriptorSacl(1,sacl,0) --- 1,34 ---- ! import sys, os ! import unittest ! import win32api, win32con, win32security ! class SecurityTests(unittest.TestCase): ! def setUp(self): ! self.pwr_sid=win32security.LookupAccountName('','Power Users')[0] ! self.admin_sid=win32security.LookupAccountName('','Administrator')[0] ! def tearDown(self): ! pass ! def testMemory(self): ! pwr_sid = self.pwr_sid ! admin_sid = self.admin_sid ! sd1=win32security.SECURITY_DESCRIPTOR() ! sd2=win32security.SECURITY_DESCRIPTOR() ! sd3=win32security.SECURITY_DESCRIPTOR() ! dacl=win32security.ACL() ! dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_READ,pwr_sid) ! dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,admin_sid) ! sd4=win32security.SECURITY_DESCRIPTOR() ! sacl=win32security.ACL() ! sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.DELETE,admin_sid,1,1) ! sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,pwr_sid,1,1) ! for x in xrange(0,200000): ! sd1.SetSecurityDescriptorOwner(admin_sid,0) ! sd2.SetSecurityDescriptorGroup(pwr_sid,0) ! sd3.SetSecurityDescriptorDacl(1,dacl,0) ! sd4.SetSecurityDescriptorSacl(1,sacl,0) + if __name__=='__main__': + unittest.main() |
From: <mha...@us...> - 2003-10-24 10:33:12
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1:/tmp/cvs-serv10436/extensions Modified Files: PyIEnumFORMATETC.cpp PyIEnumVARIANT.cpp Log Message: Tighten up iterator semantics. Only interfaces that explicitly declare they are an enumerator get the iterator slots and flags. Our 2 interfaces that support iteration make this declaration. Index: PyIEnumFORMATETC.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIEnumFORMATETC.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIEnumFORMATETC.cpp 23 Oct 2003 02:44:12 -0000 1.2 --- PyIEnumFORMATETC.cpp 23 Oct 2003 23:42:02 -0000 1.3 *************** *** 171,175 **** }; ! PyComTypeObject PyIEnumFORMATETC::type("PyIEnumFORMATETC", &PyIUnknown::type, sizeof(PyIEnumFORMATETC), --- 171,175 ---- }; ! PyComEnumTypeObject PyIEnumFORMATETC::type("PyIEnumFORMATETC", &PyIUnknown::type, sizeof(PyIEnumFORMATETC), Index: PyIEnumVARIANT.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIEnumVARIANT.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIEnumVARIANT.cpp 23 Oct 2003 02:43:04 -0000 1.3 --- PyIEnumVARIANT.cpp 23 Oct 2003 23:42:02 -0000 1.4 *************** *** 171,175 **** }; ! PyComTypeObject PyIEnumVARIANT::type("PyIEnumVARIANT", &PyIUnknown::type, // @base PyIEnumVariant|PyIUnknown sizeof(PyIEnumVARIANT), --- 171,175 ---- }; ! PyComEnumTypeObject PyIEnumVARIANT::type("PyIEnumVARIANT", &PyIUnknown::type, // @base PyIEnumVariant|PyIUnknown sizeof(PyIEnumVARIANT), |
From: <mha...@us...> - 2003-10-24 10:15:28
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1:/tmp/cvs-serv11072 Modified Files: PyIEnumIDList.cpp PyIEnumIDList.h Log Message: Move to the new iterator type. Index: PyIEnumIDList.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIEnumIDList.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIEnumIDList.cpp 6 Oct 2003 12:47:57 -0000 1.1 --- PyIEnumIDList.cpp 23 Oct 2003 23:44:41 -0000 1.2 *************** *** 26,36 **** PyObject * - PyIEnumIDList::iter() - { - Py_INCREF(this); - return this; - } - - PyObject * PyIEnumIDList::iternext() { --- 26,29 ---- *************** *** 179,183 **** }; ! PyComTypeObject PyIEnumIDList::type("PyIEnumIDList", &PyIUnknown::type, sizeof(PyIEnumIDList), --- 172,176 ---- }; ! PyComEnumTypeObject PyIEnumIDList::type("PyIEnumIDList", &PyIUnknown::type, sizeof(PyIEnumIDList), Index: PyIEnumIDList.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIEnumIDList.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIEnumIDList.h 6 Oct 2003 12:47:57 -0000 1.1 --- PyIEnumIDList.h 23 Oct 2003 23:44:41 -0000 1.2 *************** *** 10,16 **** MAKE_PYCOM_CTOR(PyIEnumIDList); static IEnumIDList *GetI(PyObject *self); ! static PyComTypeObject type; - virtual PyObject *iter(); virtual PyObject *iternext(); --- 10,15 ---- MAKE_PYCOM_CTOR(PyIEnumIDList); static IEnumIDList *GetI(PyObject *self); ! static PyComEnumTypeObject type; virtual PyObject *iternext(); |
From: <mha...@us...> - 2003-10-24 09:36:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv10436 Modified Files: MiscTypes.cpp PyIBase.cpp Log Message: Tighten up iterator semantics. Only interfaces that explicitly declare they are an enumerator get the iterator slots and flags. Our 2 interfaces that support iteration make this declaration. Index: MiscTypes.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MiscTypes.cpp 23 Oct 2003 07:34:37 -0000 1.3 --- MiscTypes.cpp 23 Oct 2003 23:42:02 -0000 1.4 *************** *** 65,69 **** 0, /*tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_HAVE_ITER, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ --- 65,69 ---- 0, /*tp_setattro */ 0, /* tp_as_buffer */ ! 0, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ *************** *** 71,76 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyIBase::iter, /* tp_iter */ ! PyIBase::iternext, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ --- 71,76 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ *************** *** 107,110 **** --- 107,119 ---- ((PyTypeObject *)ob)->tp_base == &PyInterfaceType_Type; #endif + } + + // Our type for IEnum* interfaces + PyComEnumTypeObject::PyComEnumTypeObject( const char *name, PyComTypeObject *pBase, int typeSize, struct PyMethodDef* methodList, PyIUnknown * (* thector)(IUnknown *)) : + PyComTypeObject( name, pBase, typeSize, methodList, thector) + { + tp_iter = PyIBase::iter; + tp_iternext = PyIBase::iternext; + tp_flags |= Py_TPFLAGS_HAVE_ITER; } Index: PyIBase.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIBase.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIBase.cpp 23 Oct 2003 07:34:37 -0000 1.3 --- PyIBase.cpp 23 Oct 2003 23:42:02 -0000 1.4 *************** *** 60,70 **** "iternext must be overridden by objects supporting enumeration (type '%s').", ob_type->tp_name); } - PyObject * - PyIBase::iter() - { - return PyErr_Format(PyExc_TypeError, - "COM objects of type '%s' can not be iterated.", ob_type->tp_name); - } - /*static*/int PyIBase::setattr(PyObject *op, char *name, PyObject *v) --- 60,63 ---- *************** *** 101,104 **** --- 94,102 ---- { return ((PyIBase *)ob1)->compare(ob2); + } + + /*static*/ PyObject *PyIBase::iter(PyObject *self) + { + return ((PyIBase *)self)->iter(); } |
From: Thomas H. <th...@py...> - 2003-10-24 08:20:08
|
mha...@us... writes: > Update of /cvsroot/pywin32/pywin32/win32/src > In directory sc8-pr-cvs1:/tmp/cvs-serv10400/src > > Added Files: > PythonService.rc > Log Message: > Give up in disgust trying to make version branding work with a .exe, so > revert back to the hack of a dummy rc file. I must look into py2exe's > version branding code - it seems to work! Well, somewhat. It seems that you need *any* resource in the exe (which you may want to delete afterwards, or not) otherwise you cannt insert or add other resources. Second, on win98 the version resource that py2exe creates doesn't display in the explorer file properties box. Not that I care too much about win98 anymore. Thomas |
From: <mha...@us...> - 2003-10-24 07:10:00
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv10400/src Added Files: PythonService.rc Log Message: Give up in disgust trying to make version branding work with a .exe, so revert back to the hack of a dummy rc file. I must look into py2exe's version branding code - it seems to work! --- NEW FILE: PythonService.rc --- STRINGTABLE DISCARDABLE BEGIN 2000 "Dummy" // Needed to version branding works! END |
From: <mha...@us...> - 2003-10-24 07:09:53
|
Update of /cvsroot/pywin32/pywin32/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv10400 Modified Files: PythonService EXE.dsp Log Message: Give up in disgust trying to make version branding work with a .exe, so revert back to the hack of a dummy rc file. I must look into py2exe's version branding code - it seems to work! Index: PythonService EXE.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/PythonService EXE.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PythonService EXE.dsp 16 Oct 2003 05:32:52 -0000 1.3 --- PythonService EXE.dsp 24 Oct 2003 07:04:45 -0000 1.4 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService.exe" /libpath:"./Build" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService.exe" /implib:"Build\PythonService_exe.lib" /libpath:"./Build" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService_d.exe" /pdbtype:sept /libpath:"./Build" # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService_d.exe" /pdbtype:sept /libpath:".\Build" # SUBTRACT LINK32 /pdb:none *************** *** 95,98 **** --- 95,102 ---- SOURCE=.\src\PythonService.cpp + # End Source File + # Begin Source File + + SOURCE=.\src\PythonService.rc # End Source File # End Target |
From: <mha...@us...> - 2003-10-24 06:47:29
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv5127 Modified Files: handles.py Log Message: Add a test that would cause a GC fatal error, and add some tests of TypeError exceptions. Index: handles.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/handles.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** handles.py 2 May 2003 00:05:27 -0000 1.2 --- handles.py 23 Oct 2003 04:09:56 -0000 1.3 *************** *** 1,3 **** --- 1,11 ---- import unittest + import pywintypes + import win32api + + # A class that will never die vie refcounting, but will die via GC. + class Cycle: + def __init__(self, handle): + self.cycle = self + self.handle = handle class PyHandleTestCase(unittest.TestCase): *************** *** 5,15 **** # We used to clobber all outstanding exceptions. def f1(invalidate): - """ This function throws a ZeroDivisionError. """ import win32event h = win32event.CreateEvent(None, 0, 0, None) if invalidate: - import win32api win32api.CloseHandle(int(h)) 1/0 def f2(invalidate): --- 13,24 ---- # We used to clobber all outstanding exceptions. def f1(invalidate): import win32event h = win32event.CreateEvent(None, 0, 0, None) if invalidate: win32api.CloseHandle(int(h)) 1/0 + # If we invalidated, then the object destruction code will attempt + # to close an invalid handle. We don't wan't an exception in + # this case def f2(invalidate): *************** *** 29,33 **** # The worst this does is cause an ".XXX undetected error (why=3)" # So avoiding that is the goal ! import win32event, win32api h = win32event.CreateEvent(None, 0, 0, None) # Close the handle underneath the object. --- 38,42 ---- # The worst this does is cause an ".XXX undetected error (why=3)" # So avoiding that is the goal ! import win32event h = win32event.CreateEvent(None, 0, 0, None) # Close the handle underneath the object. *************** *** 38,42 **** def testCleanup3(self): # And again with a class - no __del__ ! import win32event, win32api class Test: def __init__(self): --- 47,51 ---- def testCleanup3(self): # And again with a class - no __del__ ! import win32event class Test: def __init__(self): *************** *** 48,52 **** def testCleanupGood(self): # And check that normal error semantics *do* work. ! import win32event, win32api h = win32event.CreateEvent(None, 0, 0, None) win32api.CloseHandle(int(h)) --- 57,61 ---- def testCleanupGood(self): # And check that normal error semantics *do* work. ! import win32event h = win32event.CreateEvent(None, 0, 0, None) win32api.CloseHandle(int(h)) *************** *** 56,62 **** def testInvalid(self): - import pywintypes h=pywintypes.HANDLE(-2) self.assertRaises(win32api.error, h.Close) if __name__ == '__main__': --- 65,86 ---- def testInvalid(self): h=pywintypes.HANDLE(-2) self.assertRaises(win32api.error, h.Close) + + def testGC(self): + # This used to provoke: + # Fatal Python error: unexpected exception during garbage collection + def make(): + h=pywintypes.HANDLE(-2) + c = Cycle(h) + import gc + make() + gc.collect() + + def testTypes(self): + self.assertRaises(TypeError, pywintypes.HANDLE, "foo") + self.assertRaises(TypeError, pywintypes.HANDLE, ()) + # should be able to get a long! + pywintypes.HANDLE(0L) if __name__ == '__main__': |
From: <mha...@us...> - 2003-10-24 06:24:43
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1:/tmp/cvs-serv11587 Modified Files: Tag: Python22 win32com.dsp Log Message: New source files. Index: win32com.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com.dsp,v retrieving revision 1.19.2.1 retrieving revision 1.19.2.1.2.1 diff -C2 -d -r1.19.2.1 -r1.19.2.1.2.1 *** win32com.dsp 6 Mar 2003 02:16:52 -0000 1.19.2.1 --- win32com.dsp 23 Oct 2003 23:47:24 -0000 1.19.2.1.2.1 *************** *** 4590,4593 **** --- 4590,4612 ---- # Begin Source File + SOURCE=.\win32com\src\extensions\PyIDataObject.cpp + + !IF "$(CFG)" == "win32com - Win32 Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE SH3) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE x86em) Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Debug" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=.\win32com\src\extensions\PyIEnumCATEGORYINFO.cpp *************** *** 4848,4851 **** --- 4867,4889 ---- # Begin Source File + SOURCE=.\win32com\src\extensions\PyIEnumFORMATETC.cpp + + !IF "$(CFG)" == "win32com - Win32 Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE SH3) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE x86em) Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Debug" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=.\win32com\src\extensions\PyIEnumGUID.cpp *************** *** 5857,5860 **** --- 5895,5917 ---- # Begin Source File + SOURCE=.\win32com\src\extensions\PyIOleWindow.cpp + + !IF "$(CFG)" == "win32com - Win32 Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE SH3) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE x86em) Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Debug" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=.\win32com\src\extensions\PyIPersist.cpp *************** *** 7927,7930 **** --- 7984,8006 ---- # Begin Source File + SOURCE=.\win32com\src\extensions\PySTGMEDIUM.cpp + + !IF "$(CFG)" == "win32com - Win32 Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE SH3) Release" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE x86em) Debug" + + !ELSEIF "$(CFG)" == "win32com - Win32 (WCE MIPS) Debug" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=.\win32com\src\extensions\PyTYPEATTR.cpp *************** *** 8293,8296 **** --- 8369,8376 ---- # Begin Source File + SOURCE=.\win32com\src\include\PyIDataObject.h + # End Source File + # Begin Source File + SOURCE=.\win32com\src\include\PyIEnumConnectionPoints.h # End Source File *************** *** 8301,8304 **** --- 8381,8388 ---- # Begin Source File + SOURCE=.\win32com\src\include\PyIEnumFORMATETC.h + # End Source File + # Begin Source File + SOURCE=.\win32com\src\include\PyIEnumGUID.h # End Source File *************** *** 8322,8325 **** --- 8406,8413 ---- SOURCE=.\win32com\src\include\PyIMoniker.h + # End Source File + # Begin Source File + + SOURCE=.\win32com\src\include\PyIOleWindow.h # End Source File # Begin Source File |
From: <mha...@us...> - 2003-10-24 05:38:40
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv29333 Modified Files: win32security.i Log Message: Autoduck fixes. Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** win32security.i 23 Oct 2003 00:56:35 -0000 1.12 --- win32security.i 24 Oct 2003 05:32:33 -0000 1.13 *************** *** 1952,1956 **** static PyObject *PyLsaStorePrivateData(PyObject *self, PyObject *args) { ! // @pyparm <o PyHANDLE>||Policy handle // @pyparm string|KeyName||Registry key in which to store data // @pyparm int|PrivateData||Unicode string to be encrypted and stored --- 1952,1956 ---- static PyObject *PyLsaStorePrivateData(PyObject *self, PyObject *args) { ! // @pyparm <o PyHANDLE>|handle||Policy handle // @pyparm string|KeyName||Registry key in which to store data // @pyparm int|PrivateData||Unicode string to be encrypted and stored *************** *** 1997,2001 **** static PyObject *PyLsaRetrievePrivateData(PyObject *self, PyObject *args) { ! // @pyparm <o PyHANDLE>||Policy handle // @pyparm string|KeyName||Registry key to read PyObject *obpolicyhandle=NULL, *obkeyname=NULL, *obprivatedata=NULL; --- 1997,2001 ---- static PyObject *PyLsaRetrievePrivateData(PyObject *self, PyObject *args) { ! // @pyparm <o PyHANDLE>|handle||Policy handle // @pyparm string|KeyName||Registry key to read PyObject *obpolicyhandle=NULL, *obkeyname=NULL, *obprivatedata=NULL; |
From: <mha...@us...> - 2003-10-24 04:35:58
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv22609/com/win32com/src Modified Files: PyIDispatch.cpp Log Message: We were unconditionally calling PyErr_Clear() - stop doing that in debug builds, and instead assert if an error is pending. Later it should be removed. Index: PyIDispatch.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIDispatch.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyIDispatch.cpp 26 Apr 2001 14:27:59 -0000 1.5 --- PyIDispatch.cpp 24 Oct 2003 04:32:43 -0000 1.6 *************** *** 204,208 **** --- 204,214 ---- { /* Invoke(dispid, lcid, wflags, bResultWanted, arg1, arg2...) */ + // should be no need to clear this error - but for the next few release + // I will keep it in place for release builds, and assert in debug + #ifdef _DEBUG + assert(!PyErr_Occurred()); + #else PyErr_Clear(); + #endif int argc = PyObject_Length(args); if ( argc == -1 ) |
From: <mha...@us...> - 2003-10-24 01:54:00
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv30347 Modified Files: testall.py Log Message: Make it work with Python 2.2 unittest Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/testall.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testall.py 23 Oct 2003 05:17:23 -0000 1.1 --- testall.py 24 Oct 2003 01:49:36 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- except NameError: me = sys.argv[0] + me = os.path.abspath(me) files = os.listdir(os.path.dirname(me)) suite = unittest.TestSuite() *************** *** 21,24 **** return suite if __name__=='__main__': ! unittest.main(argv=sys.argv + ['suite']) --- 22,29 ---- return suite + class CustomLoader(unittest.TestLoader): + def loadTestsFromModule(self, module): + return suite() + if __name__=='__main__': ! unittest.TestProgram(testLoader=CustomLoader())(argv=sys.argv) |
From: <mha...@us...> - 2003-10-23 18:59:22
|
Update of /cvsroot/pywin32/pywin32/com/TestSources/PyCOMVBTest In directory sc8-pr-cvs1:/tmp/cvs-serv31253 Modified Files: PyCOMVBTest.vbp Tester.cls Added Files: EnumerableCollection.cls Log Message: Add an enumerable collection to our test object. --- NEW FILE: EnumerableCollection.cls --- VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "EnumerableCollection" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit Private col As New Collection Public Property Get Count() As Integer Count = col.Count End Property Public Sub Add(ByVal Item As Variant) col.Add Item End Sub ' Default property Public Property Get Item(v As Variant) As Variant Attribute Item.VB_UserMemId = 0 Set Item = col(v) End Property ' NewEnum must have the procedure ID -4 in Procedure Attributes dialog ' This procedure is *not* marked as hidden Public Function NewEnum() As IEnumVARIANT Attribute NewEnum.VB_UserMemId = -4 Set NewEnum = col.[_NewEnum] End Function Index: PyCOMVBTest.vbp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMVBTest/PyCOMVBTest.vbp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyCOMVBTest.vbp 18 Dec 2002 05:02:17 -0000 1.7 --- PyCOMVBTest.vbp 23 Oct 2003 07:24:24 -0000 1.8 *************** *** 4,7 **** --- 4,8 ---- Class=IPyComTestInterface; IPyComTestInterface.cls Class=PyComTestImplementation; PyComTestImplementation.cls + Class=EnumerableCollection; EnumerableCollection.cls Startup="(None)" HelpFile="" Index: Tester.cls =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMVBTest/Tester.cls,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Tester.cls 18 Dec 2002 05:02:17 -0000 1.7 --- Tester.cls 23 Oct 2003 07:24:24 -0000 1.8 *************** *** 28,31 **** --- 28,33 ---- Private mvarArrayProperty As Variant 'local copy + Public EnumerableCollectionProperty As New EnumerableCollection 'local copy + Public Type SubSubStruct int_val As Integer |
From: <mha...@us...> - 2003-10-23 15:19:41
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv28934 Modified Files: testall.py Log Message: Add support for unittest tests. Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** testall.py 3 Jul 2003 03:45:48 -0000 1.14 --- testall.py 23 Oct 2003 07:10:02 -0000 1.15 *************** *** 38,45 **** print "***** %s test FAILED after %d lines of output" % (desc, capture.get_num_lines_captured()) if __name__=='__main__': # default to "quick" test. 2==medium, 3==full testLevel = 1 - try: if len(sys.argv)>1: --- 38,46 ---- print "***** %s test FAILED after %d lines of output" % (desc, capture.get_num_lines_captured()) + unittest_modules = "testIterators".split() + if __name__=='__main__': # default to "quick" test. 2==medium, 3==full testLevel = 1 try: if len(sys.argv)>1: *************** *** 50,53 **** --- 51,66 ---- CleanGenerated() + import unittest + testRunner = unittest.TextTestRunner(verbosity=1) + for mod_name in unittest_modules: + mod = __import__(mod_name) + if hasattr(mod, "suite"): + test = mod.suite() + else: + test = unittest.defaultTestLoader.loadTestsFromModule(mod) + result = testRunner.run(test) + if not result.wasSuccessful(): + print "*" * 50 + print "Unittest tests failed" import win32com.test.util capture = win32com.test.util.CaptureWriter() |
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: |
From: <mha...@us...> - 2003-10-23 15:17:18
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv28888 Modified Files: testAXScript.py Log Message: Use the new utility function to register the server. Index: testAXScript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAXScript.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testAXScript.py 18 Nov 2002 11:20:06 -0000 1.3 --- testAXScript.py 23 Oct 2003 07:09:30 -0000 1.4 *************** *** 5,16 **** import win32com.axscript.client file = win32api.GetFullPathName(os.path.join(win32com.axscript.client.__path__[0], "pyscript.py")) ! cmd = '%s "%s" > nul' % (win32api.GetModuleFileName(0), file) ! if verbose: ! print "Registering engine" ! # print cmd ! rc = os.system(cmd) ! if rc: ! print "Registration of engine failed" ! def TestHost(verbose = 1): --- 5,10 ---- import win32com.axscript.client file = win32api.GetFullPathName(os.path.join(win32com.axscript.client.__path__[0], "pyscript.py")) ! from util import RegisterPythonServer ! RegisterPythonServer(file, verbose) def TestHost(verbose = 1): |