Commit 46144284 authored by Jérome Perrin's avatar Jérome Perrin

include filename in error message when _importFile fails.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9311 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 417c892b
......@@ -26,6 +26,7 @@
#
##############################################################################
from ZODB import POSException
from Globals import Persistent, PersistentMapping
from Acquisition import Implicit, aq_base
from AccessControl.Permission import Permission
......@@ -68,7 +69,7 @@ customImporters={
XMLExportImport.magic: XMLExportImport.importXML,
}
from zLOG import LOG, WARNING, ERROR, INFO
from zLOG import LOG, WARNING, ERROR, INFO, PANIC
from OFS.ObjectManager import customImporters
from gzip import GzipFile
from xml.dom.minidom import parse
......@@ -476,7 +477,13 @@ class ObjectTemplateItem(BaseTemplateItem):
while connection is None:
obj=obj.aq_parent
connection=obj._p_jar
try:
obj = connection.importFile(file, customImporters=customImporters)
except POSException.ExportError, e:
LOG('BusinessTemplate', PANIC, 'Failed importing %s' % file_name, error=e)
if e.args == ('Invalid export header',):
e.args = ('%s (filename: %s)' % (e.args[0], file_name), )
raise e
self._objects[file_name[:-4]] = obj
def preinstall(self, context, installed_bt, **kw):
......
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