[library-web] [mallard] guard against broken xml in pages
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] [mallard] guard against broken xml in pages
- Date: Sun, 27 Mar 2011 02:50:52 +0000 (UTC)
commit ffc60f30cd7142768e694578169ae5986cf0540b
Author: Frédéric Péters <fpeters 0d be>
Date: Sun Mar 27 08:20:04 2011 +0530
[mallard] guard against broken xml in pages
src/modtypes/mallard.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index f32c282..f0df1d2 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -36,6 +36,8 @@ try:
except ImportError:
html5lib = None
+import xml.parsers.expat
+
import errors
from base import DocModule
@@ -231,8 +233,15 @@ class MallardModule(DocModule):
xml_file = os.path.join(lang_dirname, doc_page)
if not os.path.exists(xml_file):
doc.languages.remove(lang)
+ logging.warn('failed to find %s for lang %s, removing lang' % (xml_file, lang))
+ continue
+ try:
+ page = mallard_cache.add_page(xml_file)
+ except xml.parsers.expat.ExpatError:
+ doc.languages.remove(lang)
+ logging.warn('failed to add %s to mallarc cache file for lang %s, removing lang' % (
+ xml_file, lang))
continue
- page = mallard_cache.add_page(xml_file)
if doc_page == 'index.page':
doc.title[lang] = page.link_title.text
temporary = tempfile.NamedTemporaryFile()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]