Changeset - 5b1305ddbd74
[Not reviewed]
0 1 0
Lance Edgar - 4 years ago 2021-01-27 09:28:35
lance@edbob.org
Don't choke when vendorItems record has no modified timestamp
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general) First comment
rattail_corepos/importing/corepos/api.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now