[library-web] [mallard] check declared pages are really Mallard pages
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] [mallard] check declared pages are really Mallard pages
- Date: Wed, 20 Apr 2011 13:33:23 +0000 (UTC)
commit 8d91f94b346bfeb0cf6ec2bdc120ee27e5dd3d0c
Author: Frédéric Péters <fpeters 0d be>
Date: Sun Apr 10 20:51:18 2011 +0200
[mallard] check declared pages are really Mallard pages
src/modtypes/mallard.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index 6c5c56a..f38de9c 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -42,6 +42,8 @@ def dup_node(e):
MAL_NS = 'http://projectmallard.org/1.0/'
+class NotAMallardPageException(Exception):
+ pass
class MallardPage:
id = None
@@ -55,6 +57,9 @@ class MallardPage:
self.sections = []
tree = ET.parse(filename)
+ if tree.getroot().tag != '{%s}page' % MAL_NS:
+ raise NotAMallardPageException()
+
try:
self.id = tree.getroot().attrib['id']
except KeyError:
@@ -269,6 +274,10 @@ class MallardModule(DocModule):
logging.warn('failed to add %s to mallard cache file for lang %s' % (
xml_file, lang))
continue
+ except NotAMallardPageException:
+ logging.warn('failed processing %s, not a mallard page' % xml_file)
+ doc_pages.remove(doc_page)
+ continue
if doc_page == 'index.page':
def get_plain(x):
# XXX: this should be removed, Mallard provides a text
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]