Make partition detection code on windows a little more robust

This commit is contained in:
Kovid Goyal 2008-02-13 19:04:19 +00:00
parent 6a4aec5fa5
commit dd3de8a127

View File

@ -100,8 +100,6 @@ class PRS505(Device):
@classmethod
def is_device(cls, device_id):
if not hasattr(device_id, 'upper'):
return False
device_id = device_id.upper()
if 'VEN_'+cls.VENDOR_NAME in device_id and \
'PROD_'+cls.PRODUCT_NAME in device_id:
@ -144,7 +142,7 @@ class PRS505(Device):
import wmi
c = wmi.WMI()
for drive in c.Win32_DiskDrive():
if self.__class__.is_device(drive.PNPDeviceID):
if self.__class__.is_device(str(drive.PNPDeviceID)):
if drive.Partitions == 0:
continue
try: