[pywin32-checkins] /hgroot/pywin32/pywin32: 3 new changesets
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2013-03-29 13:00:50
|
changeset 391e96f815fc in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=391e96f815fc summary: Update adodbapi to version 2.4.3. Split supfolders into separate /test and /examples changeset f56cea9acff0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f56cea9acff0 summary: remove adodbapi tests directory changeset e7a557e939d7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e7a557e939d7 summary: remove adodbapi tests directory diffstat: .hgignore | 1 + .hgtags | 1 + CHANGES.txt | 10 +- adodbapi/ado_consts.py | 1 + adodbapi/adodbapi.py | 169 +- adodbapi/examples/db_print.py | 52 + adodbapi/examples/db_table_names.py | 24 + adodbapi/examples/test.mdb | 0 adodbapi/examples/xls_read.py | 43 + adodbapi/examples/xls_write.py | 32 + adodbapi/is64bit.py | 33 + adodbapi/readme.txt | 444 ++++--- adodbapi/schema_table.py | 15 + adodbapi/test/RunTests.bat | 22 + adodbapi/test/adodbapitest.py | 993 ++++++++++++++++++ adodbapi/test/adodbapitestconfig.py | 108 + adodbapi/test/dbapi20.py | 870 +++++++++++++++ adodbapi/test/is64bit.py | 33 + adodbapi/test/setuptestframework.py | 86 + adodbapi/test/test_adodbapi_dbapi20.py | 137 ++ adodbapi/test/tryconnection2.py | 10 + adodbapi/test/tryconnection3.py | 10 + adodbapi/tests/.cvsignore | 2 - adodbapi/tests/RunTests.bat | 20 - adodbapi/tests/adodbapitest.py | 924 ---------------- adodbapi/tests/adodbapitestconfig.py | 134 -- adodbapi/tests/db_print.py | 89 - adodbapi/tests/dbapi20.py | 867 --------------- adodbapi/tests/testADOdbapi.py | 919 ---------------- adodbapi/tests/testADOdbapiConfig.py | 138 -- adodbapi/tests/testRun.bat | 21 - adodbapi/tests/test_adodbapi_dbapi20.py | 123 -- com/win32com/src/PyComHelpers.cpp | 11 + com/win32com/src/PythonCOM.cpp | 343 ++++- com/win32com/src/Register.cpp | 21 +- com/win32com/src/extensions/PyICancelMethodCalls.cpp | 96 + com/win32com/src/extensions/PyIClientSecurity.cpp | 248 ++++ com/win32com/src/extensions/PyIContext.cpp | 141 ++ com/win32com/src/extensions/PyIEnumContextProps.cpp | 159 ++ com/win32com/src/extensions/PyIEnumSTATPROPSETSTG.cpp | 113 ++ com/win32com/src/extensions/PyIEnumSTATPROPSTG.cpp | 124 ++- com/win32com/src/extensions/PyIPropertySetStorage.cpp | 86 + com/win32com/src/extensions/PyIPropertyStorage.cpp | 364 ++++++- com/win32com/src/extensions/PyIServerSecurity.cpp | 197 +++ com/win32com/src/include/PyICancelMethodCalls.h | 41 + com/win32com/src/include/PyIClientSecurity.h | 60 + com/win32com/src/include/PyIContext.h | 23 + com/win32com/src/include/PyIEnumContextProps.h | 24 + com/win32com/src/include/PyIEnumSTATPROPSETSTG.h | 27 + com/win32com/src/include/PyIEnumSTATPROPSTG.h | 26 + com/win32com/src/include/PyIPropertySetStorage.h | 33 + com/win32com/src/include/PyIPropertyStorage.h | 64 + com/win32com/src/include/PyIServerSecurity.h | 55 + com/win32com/src/include/PythonCOM.h | 1 + com/win32com/src/include/stdafx.h | 5 +- com/win32comext/shell/demos/ITransferAdviseSink.py | 74 + com/win32comext/shell/shellcon.py | 84 + com/win32comext/shell/src/PyICurrentItem.cpp | 41 + com/win32comext/shell/src/PyICurrentItem.h | 36 + com/win32comext/shell/src/PyIDisplayItem.cpp | 42 + com/win32comext/shell/src/PyIDisplayItem.h | 36 + com/win32comext/shell/src/PyIEnumResources.cpp | 268 ++++ com/win32comext/shell/src/PyIEnumResources.h | 49 + com/win32comext/shell/src/PyIIdentityName.cpp | 41 + com/win32comext/shell/src/PyIIdentityName.h | 36 + com/win32comext/shell/src/PyIRelatedItem.cpp | 108 + com/win32comext/shell/src/PyIRelatedItem.h | 41 + com/win32comext/shell/src/PyIShellItemResources.cpp | 433 +++++++ com/win32comext/shell/src/PyIShellItemResources.h | 82 + com/win32comext/shell/src/PyITransferAdviseSink.cpp | 427 +++++++ com/win32comext/shell/src/PyITransferAdviseSink.h | 76 + com/win32comext/shell/src/PyITransferDestination.cpp | 194 +++ com/win32comext/shell/src/PyITransferDestination.h | 53 + com/win32comext/shell/src/PyITransferMediumItem.cpp | 41 + com/win32comext/shell/src/PyITransferMediumItem.h | 36 + com/win32comext/shell/src/PyITransferSource.cpp | 703 ++++++++++++ com/win32comext/shell/src/PyITransferSource.h | 107 + com/win32comext/shell/src/shell.cpp | 56 +- com/win32comext/shell/src/shell_pch.h | 8 + setup.py | 17 +- win32/src/win32print/win32print.cpp | 6 +- win32/src/win32process.i | 68 + 82 files changed, 8077 insertions(+), 3679 deletions(-) diffs (truncated from 12816 to 300 lines): diff -r 4c7503da2658 -r e7a557e939d7 .hgignore --- a/.hgignore Wed Feb 06 09:37:53 2013 -0500 +++ b/.hgignore Fri Mar 29 07:00:07 2013 -0600 @@ -17,6 +17,7 @@ *.pyo Pythonwin/Scintilla/win32/*.pdb PyWin32.kpf +.idea #Pycharm # COM test bits com\TestSources\Build diff -r 4c7503da2658 -r e7a557e939d7 .hgtags --- a/.hgtags Wed Feb 06 09:37:53 2013 -0500 +++ b/.hgtags Fri Mar 29 07:00:07 2013 -0600 @@ -49,3 +49,4 @@ b7968cc5d12a148df3005979adb804ab79dd1d17 b218 b7968cc5d12a148df3005979adb804ab79dd1d17 b218 ed400a27739ff3ff7a850e69f574a1ad66de6c5e b218 +e97376eb14b6d95e79e01e1bf68ef8427bcbafdc b218.3 diff -r 4c7503da2658 -r e7a557e939d7 CHANGES.txt --- a/CHANGES.txt Wed Feb 06 09:37:53 2013 -0500 +++ b/CHANGES.txt Fri Mar 29 07:00:07 2013 -0600 @@ -6,6 +6,12 @@ Since build 218: ---------------- +* adodbapi updated to version 2.4.3 -- new examples folder includes short programs for + reading and writing .xls spreadsheets and reading ACCESS .mdb files using SQL. + New functions .is64bit.Python() and .is64bit.os() to help pick the correct drivers. + New function .schema_table.names() returns a list of all tables in a database. + see adodbapi/README.txt for more information. + * Fix issue implementing COM objects from within a virtualenv (Kevin Smyth via issue #3597965) @@ -296,7 +302,7 @@ * Added win32inet.WinHttpGetDefaultProxyConfiguration() -* Pythonwin updates from Rémi Paucher; enter completes auto-complete in +* Pythonwin updates from R�mi Paucher; enter completes auto-complete in the editor and interactive windows, auto-complete should now work on French keyboards. (XXX - some of this was reverted - update!) @@ -622,7 +628,7 @@ multiple file names, prevent Windows handle leak in IQueryAssociations. * win32com.adsi: Always return extended error info when available, and expose ADsGetLastError explicitly. -* Leonard Ritter and Robert Förtsch contributed some IE extension samples +* Leonard Ritter and Robert F�rtsch contributed some IE extension samples (see win32com\demos) * .chm documentation now includes a link to search MSDN and google for many API functions diff -r 4c7503da2658 -r e7a557e939d7 adodbapi/ado_consts.py --- a/adodbapi/ado_consts.py Wed Feb 06 09:37:53 2013 -0500 +++ b/adodbapi/ado_consts.py Fri Mar 29 07:00:07 2013 -0600 @@ -26,6 +26,7 @@ # CommandTypeEnum adCmdText = 1 adCmdStoredProc = 4 +adSchemaTables = 20 # ParameterDirectionEnum adParamInput = 1 diff -r 4c7503da2658 -r e7a557e939d7 adodbapi/adodbapi.py --- a/adodbapi/adodbapi.py Wed Feb 06 09:37:53 2013 -0500 +++ b/adodbapi/adodbapi.py Fri Mar 29 07:00:07 2013 -0600 @@ -26,7 +26,7 @@ or IronPython version 2.6 and later, or, after running through 2to3.py, CPython 3.0 or later. """ -__version__ = '2.4.2.2' +__version__ = '2.4.3' version = 'adodbapi v' + __version__ # N.O.T.E.:... # if you have been using an older version of adodbapi and are getting errors because @@ -46,15 +46,9 @@ import win32com.decimal_23 as decimal # or # from django.utils import _decimal as decimal + onIronPython = sys.platform == 'cli' -if not onIronPython: - try: - import win32com.client - except ImportError: - import warnings - warnings.warn("pywin32 package required but not found.",ImportWarning) - -# --- define objects to smooth out IronPython <-> CPython differences +# --- define objects to smooth out IronPython <-> CPython differences if onIronPython: from System import Activator, Type, DBNull, DateTime, Array, Byte from System import Decimal as SystemDecimal @@ -66,13 +60,15 @@ return obj.Item[index] else: #pywin32 try: + import win32com.client import pythoncom import pywintypes pythoncom.__future_currency__ = True def Dispatch(dispatch): return win32com.client.Dispatch(dispatch) - except: - pass #warning already given above + except ImportError: + import warnings + warnings.warn("pywin32 package required but not found.",ImportWarning) def getIndexedValue(obj,index): return obj(index) DBNull = type(None) @@ -107,6 +103,22 @@ raise errorclass(errorvalue) # ----- Time converters ---------------------------------------------- + +# all purpose date to ISO format converter +def _dateObjectToIsoFormatString(obj): + if isinstance(obj, datetime.datetime): + s = obj.strftime('%Y-%m-%d %H:%M:%S') + elif isinstance(obj, datetime.date): #exact midnight + s = obj.strftime('%Y-%m-%d 00:00:00') + elif isinstance(obj, time.struct_time): + s = time.strftime('%Y-%m-%d %H:%M:%S',obj) + else: + try: #usually datetime.datetime + s = obj.isoformat() + except: #but may be mxdatetime + s = obj.Format('%Y-%m-%d %H:%M:%S') + return s + class TimeConverter(object): # this is a generic time converter skeleton def __init__(self): # the details will be filled in by instances self._ordinal_1899_12_31=datetime.date(1899,12,31).toordinal()-1 @@ -131,7 +143,7 @@ raise NotImplementedError #"Abstract class" def DateObjectToIsoFormatString(self,obj): "This function should return a string in the format 'YYYY-MM-dd HH:MM:SS:ms' (ms optional) " - raise NotImplementedError #"Abstract class" + raise NotImplementedError #"Abstract class" # -- Optional: if mx extensions are installed you may use mxDateTime ---- try: @@ -156,7 +168,7 @@ def Timestamp(self,year,month,day,hour,minute,second): return mx.DateTime.Timestamp(year,month,day,hour,minute,second) def DateObjectToIsoFormatString(self,obj): - return obj.Format('%Y-%m-%d %H:%M:%S') + return _dateObjectToIsoFormatString(obj) else: class mxDateTimeConverter(TimeConverter): pass # if no mx is installed @@ -203,16 +215,7 @@ fractPart = ms / 86400000.0 return integerPart + fractPart def DateObjectToIsoFormatString(self,obj): - if isinstance(obj,datetime.datetime): - s = obj.strftime('%Y-%m-%d %H:%M:%S') - elif isinstance(obj,datetime.date): #exact midnight - s = obj.strftime('%Y-%m-%d 00:00:00') - else: - try: #usually datetime.datetime - s = obj.isoformat() - except: #but may be mxdatetime - s = obj.Format('%Y-%m-%d %H:%M:%S') - return s + return _dateObjectToIsoFormatString(obj) class pythonTimeConverter(TimeConverter): # the old, ?nix type date and time def __init__(self): #caution: this Class gets confised by timezones and DST @@ -244,11 +247,7 @@ def Timestamp(self,year,month,day,hour,minute,second): return time.localtime(time.mktime((year,month,day,hour,minute,second,0,0,-1))) def DateObjectToIsoFormatString(self,obj): - try: - s = time.strftime('%Y-%m-%d %H:%M:%S',obj) - except: - s = obj.strftime('%Y-%m-%d') - return s + return _dateObjectToIsoFormatString(obj) dateconverter = pythonDateTimeConverter() # default # ----------------------------------------------------------- @@ -372,17 +371,16 @@ except: return '[]' -def _configure_parameter(p, value, settings_known): +def _configure_parameter(p, value, adotype, settings_known): """Configure the given ADO Parameter 'p' with the Python 'value'.""" - if verbose > 3: - print 'Configuring parameter %s type=%s value="%s"' % (p.Name,p.Type,repr(value)) - if p.Direction not in [adc.adParamInput, adc.adParamInputOutput, adc.adParamUnknown]: - return + if adotype in adoBinaryTypes: + p.Size = len(value) + p.AppendChunk(value) - if isinstance(value,StringTypes): #v2.1 Jevon + elif isinstance(value,StringTypes): #v2.1 Jevon L = len(value) - if p.Type in adoStringTypes: #v2.2.1 Cole + if adotype in adoStringTypes: #v2.2.1 Cole if settings_known: L = min(L,p.Size) #v2.1 Cole limit data to defined size p.Value = value[:L] #v2.1 Jevon & v2.1 Cole else: @@ -390,10 +388,6 @@ if L>0: #v2.1 Cole something does not like p.Size as Zero p.Size = L #v2.1 Jevon - elif isinstance(value, memoryViewType): - p.Size = len(value) - p.AppendChunk(value) - elif isinstance(value, decimal.Decimal): if onIronPython: s = str(value) @@ -415,7 +409,7 @@ p.Precision = digit_count + exponent elif type(value) in dateconverter.types: - if settings_known and p.Type in adoDateTimeTypes: + if settings_known and adotype in adoDateTimeTypes: p.Value=dateconverter.COMDate(value) else: #probably a string #Known problem with JET Provider. Date can not be specified as a COM date. @@ -425,7 +419,7 @@ p.Value = s p.Size = len(s) - elif isinstance(value, longType) and onIronPython: # Iron Python Long + elif onIronPython and isinstance(value, longType) and sys.version_info < (2,7,2): # Iron Python Long s = SystemDecimal(value) # feature workaround for IPy 2.0 p.Value = s @@ -911,20 +905,23 @@ cursor if the sproc defines an integer return value. """ self._new_command(procname, adc.adCmdStoredProc) - self._buildADOparameterList(procname, parameters) + self._buildADOparameterList(procname, parameters, do_refresh=True) + if verbose > 2: + print 'Params=', format_parameters(self.cmd.Parameters, True) self._execute_command() - if parameters != None: - retLst=[] - for p in tuple(self.cmd.Parameters): - if verbose > 2: - print 'returning=', p.Name, p.Type, p.Direction, repr(p.Value) - pyObject=_convert_to_python(p.Value,variantConversions[p.Type]) - if p.Direction == adc.adParamReturnValue: - self.returnValue=pyObject - else: - retLst.append(pyObject) - return retLst + retLst=[] + for p in tuple(self.cmd.Parameters): + if verbose > 2: + print "Returned=Name: %s, Dir.: %s, Type: %s, Size: %s, Value: \"%s\", Precision: %s, NumericScale: %s" % \ + (p.Name, adc.directions[p.Direction], adc.adTypeNames.get(p.Type, str(p.Type)+' (unknown type)'), + p.Size, p.Value, p.Precision, p.NumericScale) + pyObject = _convert_to_python(p.Value,variantConversions[p.Type]) + if p.Direction == adc.adParamReturnValue: + self.returnValue = pyObject + else: + retLst.append(pyObject) + return retLst # return the parameter list to the caller def _reformat_operation(self,operation,parameters): if parameters: @@ -934,44 +931,40 @@ operation, parameters = self._namedToQmark(operation,parameters) return operation,parameters - def _buildADOparameterList(self, operation, parameters): + def _buildADOparameterList(self, operation, parameters, do_refresh=False): self.parameters = parameters self.cmd.CommandText = operation - if parameters != None: + + parameters_known = False + if do_refresh: # needed only if we are calling a stored procedure try: # attempt to use ADO's parameter list self.cmd.Parameters.Refresh() - self.parameters_known = True - except: # if it blows up - self.parameters_known = False - if not self.parameters_known: #-- build own parameter list - if verbose: - print('error in COM Refresh(), so adodbapi is building a parameter list') + parameters_known = True + except: + pass + + if parameters != None: + if parameters_known: # use ado parameter list + i = 0 |