- Timestamp:
- 25 Nov 2014, 11:29:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/batching.py
r12005 r12054 379 379 380 380 location_fields = [] 381 additional_fields = ['document_id' ]382 additional_headers = [ ]381 additional_fields = ['document_id', 'classname'] 382 additional_headers = ['classname'] 383 383 384 384 def checkHeaders(self, headerfields, mode='ignore'): … … 437 437 errs, inv_errs, conv_dict = super( 438 438 CustomerDocumentProcessor, self).checkConversion(row, mode=mode) 439 439 # We need to check if the classname corresponds with the 440 # processor chosen. This is to avoid accidentally wrong imports. 441 if mode != 'remove': 442 classname = row.get('classname', None) 443 if classname != self.factory_name.strip('waeup.'): 444 errs.append(('classname','wrong processor')) 440 445 # We have to check document_id. 441 446 document_id = row.get('document_id', None) 442 if not document_id:443 document_id = generate_document_id()444 conv_dict['document_id'] = document_id445 return errs, inv_errs, conv_dict446 # document_id must not exist.447 447 if mode == 'create': 448 if not document_id: 449 document_id = generate_document_id() 450 conv_dict['document_id'] = document_id 451 return errs, inv_errs, conv_dict 448 452 cat = queryUtility(ICatalog, name='documents_catalog') 449 453 results = list( 450 454 cat.searchResults(document_id=(document_id, document_id))) 451 455 if results: 456 # document_id must not exist. 452 457 errs.append(('document_id','id exists')) 453 if not document_id.startswith('d'): 454 errs.append(('document_id','invalid format')) 458 else: 459 if not document_id.startswith('d'): 460 errs.append(('document_id','invalid format')) 455 461 return errs, inv_errs, conv_dict
Note: See TracChangeset for help on using the changeset viewer.