[kupfer: 2/7] clawsmail: catch exceptions on parse invalid xml file
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 2/7] clawsmail: catch exceptions on parse invalid xml file
- Date: Fri, 21 May 2010 12:06:03 +0000 (UTC)
commit d21462d5bcba630269b5a852627d51f2235d5de7
Author: Karol BÄ?dkowski <karol bedkowski gmail com>
Date: Wed May 19 20:23:14 2010 +0200
clawsmail: catch exceptions on parse invalid xml file
This is workaround for invalid xml files produced by some versions of
ClawsMail.
kupfer/plugin/clawsmail.py | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/plugin/clawsmail.py b/kupfer/plugin/clawsmail.py
index a8dc57d..61b32f3 100644
--- a/kupfer/plugin/clawsmail.py
+++ b/kupfer/plugin/clawsmail.py
@@ -3,11 +3,12 @@ __kupfer_name__ = _("Claws Mail")
__kupfer_sources__ = ("ClawsContactsSource", )
__kupfer_actions__ = ("NewMailAction", "SendFileByMail")
__description__ = _("Claws Mail Contacts and Actions")
-__version__ = "2010-01-07"
+__version__ = "2010-05-19"
__author__ = "Karol BÄ?dkowski <karol bedkowski gmail com>"
import os
from xml.dom import minidom
+import xml
from kupfer.objects import Leaf, Action, Source
from kupfer.objects import TextLeaf, UrlLeaf, RunnableLeaf, FileLeaf
@@ -148,8 +149,7 @@ class ClawsContactsSource(AppLeafContentMixin, ToplevelGroupingSource,
for address in addresses:
email = address.getAttribute('email')
yield EmailContact(email, cn)
-
- except StandardError, err:
+ except (StandardError, xml.parsers.expat.ExpatError), err:
self.output_error(err)
yield ComposeMail()
@@ -176,8 +176,7 @@ class ClawsContactsSource(AppLeafContentMixin, ToplevelGroupingSource,
dtree = minidom.parse(self._claws_addrbook_index)
for book in dtree.getElementsByTagName('book'):
yield book.getAttribute('file')
-
- except StandardError, err:
+ except (StandardError, xml.parsers.expat.ExpatError), err:
self.output_error(err)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]