Don't choke when vendorItems record has no modified timestamp
This commit is contained in:
		
							parent
							
								
									da55a07982
								
							
						
					
					
						commit
						5b1305ddbd
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -575,7 +575,10 @@ class ProductImporter(FromCOREPOSAPI, corepos_importing.model.ProductImporter): | |||
|                 # pseudo-default" vendorItems record | ||||
| 
 | ||||
|                 def sortkey(item): | ||||
|                     dt = datetime.datetime.strptime(item['modified'], '%Y-%m-%d %H:%M:%S') | ||||
|                     modified = item.get('modified') | ||||
|                     if not modified: | ||||
|                         return datetime.datetime(1900, 1, 1) | ||||
|                     dt = datetime.datetime.strptime(modified, '%Y-%m-%d %H:%M:%S') | ||||
|                     return dt | ||||
| 
 | ||||
|                 items = sorted(items, key=sortkey, reverse=True) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar