Ignore:
Timestamp:
16 Dec 2014, 09:02:13 (10 years ago)
Author:
Henrik Bettermann
Message:

Some repairs of document and contract batch processors (work in progress!).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/batching.py

    r12212 r12250  
    381381
    382382    location_fields = []
    383     additional_fields = ['document_id', 'class_name']
     383    additional_fields = ['class_name']
    384384    additional_headers = ['class_name']
    385385
     
    422422        document_id = row['document_id'].strip('#')
    423423        parent[document_id] = obj
     424        # Reset _curr_doc_id if document_id has been imported
     425        site = grok.getSite()
     426        if row.get('document_id', None) not in (None, IGNORE_MARKER):
     427            site._curr_doc_id -= 1
    424428        return
    425429
     
    445449            if class_name != self.factory_name.strip('waeup.'):
    446450                errs.append(('class_name','wrong processor'))
     451        try:
     452            # Correct doc_id counter. As the IConverter for documents
     453            # creates document objects that are not used afterwards, we
     454            # have to fix the site-wide doc_id counter.
     455            site = grok.getSite()
     456            site._curr_doc_id -= 1
     457        except (KeyError, TypeError, AttributeError):
     458                pass
    447459        # We have to check document_id.
    448460        document_id = row.get('document_id', None)
     
    478490
    479491    location_fields = []
    480     additional_fields = ['contract_id', 'class_name']
     492    additional_fields = ['class_name']
    481493    additional_headers = ['class_name']
    482494
     
    519531        contract_id = row['contract_id'].strip('#')
    520532        parent[contract_id] = obj
     533        # Reset _curr_con_id if contract_id has been imported
     534        site = grok.getSite()
     535        if row.get('contract_id', None) not in (None, IGNORE_MARKER):
     536            site._curr_con_id -= 1
    521537        return
    522538
     
    542558            if class_name != self.factory_name.strip('waeup.'):
    543559                errs.append(('class_name','wrong processor'))
     560        try:
     561            # Correct con_id counter. As the IConverter for contracts
     562            # creates contract objects that are not used afterwards, we
     563            # have to fix the site-wide con_id counter.
     564            site = grok.getSite()
     565            site._curr_con_id -= 1
     566        except (KeyError, TypeError, AttributeError):
     567                pass
    544568        # We have to check contract_id.
    545569        contract_id = row.get('contract_id', None)
Note: See TracChangeset for help on using the changeset viewer.