gget r136 - trunk/gget



Author: johans
Date: Sun Jan 18 23:22:42 2009
New Revision: 136
URL: http://svn.gnome.org/viewvc/gget?rev=136&view=rev

Log:
Added some error checks when loading the XML file.

Modified:
   trunk/gget/download_list.py
   trunk/gget/download_manager.py

Modified: trunk/gget/download_list.py
==============================================================================
--- trunk/gget/download_list.py	(original)
+++ trunk/gget/download_list.py	Sun Jan 18 23:22:42 2009
@@ -72,12 +72,17 @@
 
                 download = Download(uri, path, date_started, date_completed)
                 download.file_name = file_name
-                download.total_size = int(total_size)
-                download.status = int(status)
+                if total_size:
+                    download.total_size = int(total_size)
+                if status:
+                    download.status = int(status)
                 if download.status == COMPLETED:
                     download.percent_complete = 100
                 else:
-                    download.percent_complete = 100 * download.current_size / download.total_size
+                    if download.total_size != 0:
+                        download.percent_complete = 100 * download.current_size / download.total_size
+                    else:
+                        download.percent_complete = 0
                 self.__append_download(download)
 
     def __create_xml(self):

Modified: trunk/gget/download_manager.py
==============================================================================
--- trunk/gget/download_manager.py	(original)
+++ trunk/gget/download_manager.py	Sun Jan 18 23:22:42 2009
@@ -21,6 +21,7 @@
 import os.path
 import sys
 import thread
+import traceback
 from gettext import gettext as _
 
 import gtk
@@ -140,7 +141,8 @@
                 print "Failed downloading of file %s" % download.uri
 
         except Exception, e:
-            print "Exception caught in DownloadManager.__start_download: " + e
+            print "Exception caught in DownloadManager.__start_download: "
+            traceback.print_exc()
 
     def set_proxy(self, protocol, proxy):
         """Sets the proxy to use for the specified protocol."""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]