no processing if file does not exist (yet), thus avoiding erroneous value for documentPropertiesAccessible attribute
This commit is contained in:
		
							parent
							
								
									a47b6a02a0
								
							
						
					
					
						commit
						6a91788d9e
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -89,11 +89,15 @@ class OfficeFile(ExternalFileAdapter): | ||||||
|     def docPropertyDom(self): |     def docPropertyDom(self): | ||||||
|         fn = self.docFilename |         fn = self.docFilename | ||||||
|         result = dict(core=[], custom=[]) |         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) |         root, ext = os.path.splitext(fn) | ||||||
|         if not ext.lower() in self.fileExtensions: |         if not ext.lower() in self.fileExtensions: | ||||||
|             return result |             return result | ||||||
|         try: |         try: | ||||||
|             zf = ZipFile(fn, 'r') |             zf = ZipFile(fn, 'r') | ||||||
|  |             self.documentPropertiesAccessible = True | ||||||
|         except (IOError, BadZipfile), e: |         except (IOError, BadZipfile), e: | ||||||
|             from logging import getLogger |             from logging import getLogger | ||||||
|             self.logger.warn(e) |             self.logger.warn(e) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue