Commit b187cc9b authored by Nicolas Dumazet's avatar Nicolas Dumazet

Catch xml.parser.expat.ExpatError when an invalid bt5 repo is passed along


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29793 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9478426a
......@@ -45,6 +45,7 @@ from cStringIO import StringIO
from urllib import pathname2url, urlopen, splittype, urlretrieve
import re
from xml.dom.minidom import parse
from xml.parsers.expat import ExpatError
import struct
import cPickle
import posixpath
......@@ -526,7 +527,17 @@ class TemplateTool (BaseTool):
f = urlopen(url)
property_dict_list = []
try:
doc = parse(f)
try:
doc = parse(f)
except ExpatError:
if REQUEST is not None:
psm = translateString('Invalid repository: ${repo}',
mapping={'repo':repository})
REQUEST.RESPONSE.redirect("%s?portal_status_message=%s"
% (self.absolute_url(), psm))
return
else:
raise RuntimeError, 'Invalid repository: %s' % repository
try:
root = doc.documentElement
for template in root.getElementsByTagName("template"):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment