deskbar-applet r1828 - trunk/deskbar/handlers/actions



Author: sebp
Date: Thu Jan 10 22:37:48 2008
New Revision: 1828
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=1828&view=rev

Log:
Catching RuntimeException in is_valid and return False if it occurs

Modified:
   trunk/deskbar/handlers/actions/OpenFileAction.py

Modified: trunk/deskbar/handlers/actions/OpenFileAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenFileAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenFileAction.py	Thu Jan 10 22:37:48 2008
@@ -30,8 +30,12 @@
         if not exists(url):
             return False
         else:
-            mime_type = gnomevfs.get_mime_type(url)
-            return gnomevfs.mime_get_default_application(mime_type) != None
+            try:
+                mime_type = gnomevfs.get_mime_type(url)
+                return gnomevfs.mime_get_default_application(mime_type) != None
+            except RuntimeError, e:
+                # get_mime_type throws a RuntimeException when something went wrong
+                return False
     
     def get_hash(self):
         return self._url



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