[damned-lies] Don't crash when parsing doap file raises an error



commit 90229021256e4a34cd30711dd04a508480f2156f
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Oct 14 09:14:07 2016 +0200

    Don't crash when parsing doap file raises an error

 stats/doap.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/stats/doap.py b/stats/doap.py
index 4a7adfe..57e73bf 100644
--- a/stats/doap.py
+++ b/stats/doap.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 import os
 import re
-from xml.etree.ElementTree import parse
+from xml.etree.ElementTree import ParseError, parse
 
 from django.utils.encoding import force_text
 from django.utils.six.moves.urllib.parse import unquote
@@ -55,7 +55,10 @@ def update_doap_infos(module):
     doap_path = os.path.join(module.get_head_branch().co_path(), "%s.doap" % module.name)
     if not os.access(doap_path, os.F_OK):
         return
-    tree = DoapParser(doap_path)
+    try:
+        tree = DoapParser(doap_path)
+    except ParseError:
+        return
 
     # *********** Update maintainers
     def slugify(val):


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