Changeset 1477
- Timestamp:
- 06/29/08 11:56:16 (5 months ago)
- Files:
-
- wine-doors/branches/0.2/src/utils.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wine-doors/branches/0.2/src/utils.py
r1476 r1477 32 32 re_largest_val = re.compile('(.*?)\.(.*)') 33 33 str_a = a_minor 34 str_b = b_minor 34 str_b = b_minor 35 35 while 1: 36 36 if str_a.find(".") >= 0: … … 61 61 return -1 62 62 63 # We should have returned by now, if we haven't we'll return something unexpected 64 return None 63 # Raise an exception if the function has failed to determine which is higher 64 error_msg = "Cannot determine if \"%s\" is less than or larger than \"%s\"" % (ver_a, ver_b) 65 raise ValueError, error_msg 65 66 66 67 def SplitPackageString ( package_string ): … … 119 120 class Download: 120 121 def __init__( self, remote_uri, local_uri, username=None, password=None, callback=None, cache_timeout=True ): 121 """122 All reporting should be done through the callback if it exists, rather than accessing parent123 We need to handle download errors too, md5/file size/borked somehow else, we need to work on better callbacks!124 """125 122 self.local_uri = urllib.unquote(local_uri) 126 123 self.callback = callback … … 224 221 return True 225 222 226 def UTDownloadCallback( fraction):227 percent = round( fraction * 100)223 def UTDownloadCallback(download): 224 percent = round(download.fraction * 100) 228 225 print "Downloader returned %d" % percent 229 226
