diff options
author | Dan Williams <dcbw@localhost.localdomain> | 2006-09-22 16:50:55 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@localhost.localdomain> | 2006-09-22 16:50:55 (GMT) |
commit | 801d02005893601a8037f392bb290038c21bd051 (patch) | |
tree | 257259b2e08ff340cf3019ffbe84ce2d035f05c5 /shell | |
parent | 7061434703103bb84d01b774d49d2b17498c160f (diff) |
Don't die on malformed friends config file
Diffstat (limited to 'shell')
-rw-r--r-- | shell/model/Friends.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/shell/model/Friends.py b/shell/model/Friends.py index b90f9d9..4a2298c 100644 --- a/shell/model/Friends.py +++ b/shell/model/Friends.py @@ -5,6 +5,7 @@ import gobject from model.BuddyModel import BuddyModel from sugar import env +import logging class Friends(gobject.GObject): __gsignals__ = { @@ -45,12 +46,16 @@ class Friends(gobject.GObject): def load(self): cp = ConfigParser() - if cp.read([self._path]): - for name in cp.sections(): - buddy = BuddyModel() - buddy.set_name(name) - buddy.set_color(cp.get(name, 'color')) - self.add_friend(buddy) + try: + success = cp.read([self._path]) + if success: + for name in cp.sections(): + buddy = BuddyModel() + buddy.set_name(name) + buddy.set_color(cp.get(name, 'color')) + self.add_friend(buddy) + except Exception, exc: + logging.error("Error parsing friends file: %s" % exc) def save(self): cp = ConfigParser() |