Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/win32/Lib
Modified Files:
win32serviceutil.py win32timezone.py
Log Message:
various syntax modernizations
Index: win32serviceutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** win32serviceutil.py 2 Oct 2008 12:09:53 -0000 1.27
--- win32serviceutil.py 26 Nov 2008 08:39:33 -0000 1.28
***************
*** 10,14 ****
import sys, string, pywintypes, os
! error = "Python Service Utility Error"
def LocatePythonServiceExe(exeName = None):
--- 10,14 ----
import sys, string, pywintypes, os
! error = RuntimeError
def LocatePythonServiceExe(exeName = None):
***************
*** 32,38 ****
if os.path.isfile(exeName):
return exeName
! raise RuntimeError, "The executable '%s' is registered as the Python " \
! "service exe, but it does not exist as specified" \
! % exeName
except win32api.error:
# OK - not there - lets go a-searchin'
--- 32,38 ----
if os.path.isfile(exeName):
return exeName
! raise RuntimeError("The executable '%s' is registered as the Python " \
! "service exe, but it does not exist as specified" \
! % exeName)
except win32api.error:
# OK - not there - lets go a-searchin'
***************
*** 46,50 ****
except win32api.error:
msg = "%s is not correctly registered\nPlease locate and run %s, and it will self-register\nThen run this service registration process again." % (exeName, exeName)
! raise error, msg
def _GetServiceShortName(longName):
--- 46,50 ----
except win32api.error:
msg = "%s is not correctly registered\nPlease locate and run %s, and it will self-register\nThen run this service registration process again." % (exeName, exeName)
! raise error(msg)
def _GetServiceShortName(longName):
***************
*** 105,109 ****
pass
if not dllName:
! raise ValueError, "The name of the performance DLL must be available"
dllName = win32api.GetFullPathName(dllName)
# Now setup all the required "Performance" entries.
--- 105,109 ----
pass
if not dllName:
! raise ValueError("The name of the performance DLL must be available")
dllName = win32api.GetFullPathName(dllName)
# Now setup all the required "Performance" entries.
***************
*** 349,353 ****
win32api.Sleep(250)
else:
! raise pywintypes.error, (winerror.ERROR_SERVICE_REQUEST_TIMEOUT, "QueryServiceStatus", win32api.FormatMessage(winerror.ERROR_SERVICE_REQUEST_TIMEOUT)[:-2])
def __StopServiceWithTimeout(hs, waitSecs = 30):
--- 349,353 ----
win32api.Sleep(250)
else:
! raise pywintypes.error(winerror.ERROR_SERVICE_REQUEST_TIMEOUT, "QueryServiceStatus", win32api.FormatMessage(winerror.ERROR_SERVICE_REQUEST_TIMEOUT)[:-2])
def __StopServiceWithTimeout(hs, waitSecs = 30):
***************
*** 356,360 ****
except pywintypes.error, (hr, name, msg):
if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error, (hr, name, msg)
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
--- 356,360 ----
except pywintypes.error, (hr, name, msg):
if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
***************
*** 363,367 ****
win32api.Sleep(1000)
else:
! raise pywintypes.error, (winerror.ERROR_SERVICE_REQUEST_TIMEOUT, "ControlService", win32api.FormatMessage(winerror.ERROR_SERVICE_REQUEST_TIMEOUT)[:-2])
--- 363,367 ----
win32api.Sleep(1000)
else:
! raise pywintypes.error(winerror.ERROR_SERVICE_REQUEST_TIMEOUT, "ControlService", win32api.FormatMessage(winerror.ERROR_SERVICE_REQUEST_TIMEOUT)[:-2])
***************
*** 410,414 ****
# Allow only "service not running" error
if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error, (hr, name, msg)
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
--- 410,414 ----
# Allow only "service not running" error
if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
***************
*** 467,471 ****
fname = os.path.join(path, win32api.FindFiles(fname)[0][8])
except win32api.error:
! raise error, "Could not resolve the path name '%s' to a full path" % (argv[0])
modName = os.path.splitext(fname)[0]
return modName + "." + cls.__name__
--- 467,471 ----
fname = os.path.join(path, win32api.FindFiles(fname)[0][8])
except win32api.error:
! raise error("Could not resolve the path name '%s' to a full path" % (argv[0]))
modName = os.path.splitext(fname)[0]
return modName + "." + cls.__name__
Index: win32timezone.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** win32timezone.py 10 Nov 2008 23:59:59 -0000 1.11
--- win32timezone.py 26 Nov 2008 08:39:33 -0000 1.12
***************
*** 234,238 ****
key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath)
except:
! raise ValueError, 'Timezone Name %s not found.' % timeZoneName
return key
--- 234,238 ----
key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath)
except:
! raise ValueError('Timezone Name %s not found.' % timeZoneName)
return key
***************
*** 576,580 ****
key = self._find_first_match_(sortedKeys, item)
result = dict.__getitem__(self, key)
! if isinstance(result, RangeValueUndefined): raise KeyError, key
return result
--- 576,580 ----
key = self._find_first_match_(sortedKeys, item)
result = dict.__getitem__(self, key)
! if isinstance(result, RangeValueUndefined): raise KeyError(key)
return result
|