Commit 46c23280 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

unit tests should work without an internet connection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25770 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c85be8a0
This diff is collapsed.
......@@ -59,11 +59,8 @@ if lxml:
def __init__(self, schema_url=schema_url):
self.schema_url = schema_url
self.schema_path = os.path.join(
tempfile.gettempdir(), 'OpenDocument.rng')
# download if local copy does not exists
if not os.path.exists(self.schema_path):
self._download()
self.relaxng = lxml.etree.RelaxNG(lxml.etree.parse(open(self.schema_path)))
os.path.dirname(__file__), os.path.basename(schema_url))
self.relaxng = lxml.etree.RelaxNG(lxml.etree.parse(self.schema_path))
def validate(self, odf_file_content):
error_list = []
......@@ -72,15 +69,6 @@ if lxml:
error_list.extend(self._validateXML(odf_file, f))
return error_list
def _download(self):
r = urllib2.urlopen(self.schema_url)
out_file = open(self.schema_path, 'w')
try:
out_file.write(r.read())
finally:
out_file.close()
r.close()
def _validateXML(self, odf_file, content_file_name):
zfd = zipfile.ZipFile(odf_file)
doc = lxml.etree.parse(StringIO(zfd.read(content_file_name)))
......
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