From 6a91788d9e38d04beedf58b2699a87b7bdaca162 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Mon, 14 Apr 2014 19:05:40 +0200 Subject: [PATCH] no processing if file does not exist (yet), thus avoiding erroneous value for documentPropertiesAccessible attribute --- integrator/office/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/integrator/office/base.py b/integrator/office/base.py index 3e0cb9f..6271d9f 100644 --- a/integrator/office/base.py +++ b/integrator/office/base.py @@ -89,11 +89,15 @@ class OfficeFile(ExternalFileAdapter): def docPropertyDom(self): fn = self.docFilename result = dict(core=[], custom=[]) + if not os.path.exists(fn): + # may happen before file has been created + return result root, ext = os.path.splitext(fn) if not ext.lower() in self.fileExtensions: return result try: zf = ZipFile(fn, 'r') + self.documentPropertiesAccessible = True except (IOError, BadZipfile), e: from logging import getLogger self.logger.warn(e)