Allow execm input handlers to set arbitrary data fields

This commit is contained in:
Jean-Francois Dockes
2016-07-11 18:13:39 +02:00
parent e893ee836b
commit b9e672abda
3 changed files with 47 additions and 14 deletions
+11
View File
@@ -21,6 +21,7 @@
from __future__ import print_function
import os
import posixpath
import fnmatch
import rclexecm
from zipfile import ZipFile
@@ -89,6 +90,16 @@ class ZipExtractor:
#raise BadZipfile()
else:
docdata = self.zip.read(ipath)
try:
# We are assuming here that the zip uses forward slash
# separators, which is not necessarily the case. At
# worse, we'll get a wrong or no file name, which is
# no big deal (the ipath is the important data
# element).
filename = posixpath.basename(ipath)
self.em.setfield("filename", filename)
except:
pass
ok = True
except Exception as err:
self.em.rclog("extractone: failed: [%s]" % err)