[pitivi] settings: Add a try/except to catch issues with broken config files.



commit e684a7f47f18370df6d56b80d5759b54e33abfbb
Author: Edward Hervey <bilboed bilboed com>
Date:   Tue May 5 13:34:39 2009 +0200

    settings: Add a try/except to catch issues with broken config files.
    
    We should get rid of this in the long run.
---
 pitivi/settings.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pitivi/settings.py b/pitivi/settings.py
index 03ce3f5..56fbabf 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -166,7 +166,13 @@ class GlobalSettings(object, Signallable):
                 continue
             if key and self._config.has_option(section, key):
                 if typ == int or typ == long:
-                    value = self._config.getint(section, key)
+                    # WARNING/FIXME : This try/except is for a small cockup in previous
+                    # configurations where we stored a float value... but declared it
+                    # as an integer.
+                    try:
+                        value = self._config.getint(section, key)
+                    except ValueError:
+                        value = int(self._config.getfloat(section, key))
                 elif typ == float:
                     value = self._config.getfloat(section, key)
                 elif typ == bool:



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