[orca/new-settings] Added minimal checks for a correct import



commit f605cae145151c43520c8e8a1f046a15f7082574
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date:   Thu Oct 28 18:47:16 2010 +0200

    Added minimal checks for a correct import

 src/orca/settings_manager.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 6309e9b..6e6837e 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -362,7 +362,11 @@ class SettingsManager():
     def importProfile(self, fileName):
         """Import profile from a given filename"""
 
-        profileFile = open(fileName)
+        try:
+            profileFile = open(fileName)
+        except:
+            return False
+
         prefs = load(profileFile)
 
         general = {}
@@ -375,9 +379,10 @@ class SettingsManager():
         keybindings = prefs['keybindings']
         profile = prefs['profile']
 
-        self.saveSettings(general,
-                          pronunciations,
-                          keybindings)
+        if self.saveSettings(general, pronunciations, keybindings):
+            return True
+        else:
+            return False
 
 def getVoiceKey(voice):
     voicesKeys = getattr(settings, 'voicesKeys')



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