From 20c3590369d736551d2d5e981cadc219e13bfc21 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 21 Apr 2015 13:41:35 +0000 Subject: Copy XSL files on a temporary directory before processing to prevent multi-thread clash --- xhtml2odt/xhtml2odt.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'xhtml2odt/xhtml2odt.py') diff --git a/xhtml2odt/xhtml2odt.py b/xhtml2odt/xhtml2odt.py index aa387d54e..340a980cb 100755 --- a/xhtml2odt/xhtml2odt.py +++ b/xhtml2odt/xhtml2odt.py @@ -1,10 +1,12 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- -""" +u""" xhtml2odt - XHTML to ODT XML transformation =========================================== Copyright (C) 2009-2010 Aurelien Bompard +Copyright (C) 2015 Étienne Loks This script can convert a wiki page to the OpenDocument Text (ODT) format, standardized as ISO/IEC 26300:2006, and the native format of office suites such @@ -257,7 +259,10 @@ class ODTFile(object): :rtype: str """ xsl_dir = os.path.join(INSTALL_PATH, 'xsl') - xslt_doc = etree.parse(os.path.join(xsl_dir, "xhtml2odt.xsl")) + tmpdirxsl = os.path.join(tempfile.mkdtemp(prefix="xhtml2odt-"), 'xsl') + shutil.copytree(xsl_dir, tmpdirxsl) + + xslt_doc = etree.parse(os.path.join(tmpdirxsl, "xhtml2odt.xsl")) transform = etree.XSLT(xslt_doc) xhtml = self.handle_images(xhtml) xhtml = self.handle_links(xhtml) -- cgit v1.2.3