Skip to content

Commit

Permalink
Merge branch 'document_service'
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Oct 7, 2016
2 parents 6a95f70 + f91fcc8 commit 14c903d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/openprocurement/api/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,14 @@ def __init__(self, registry):
doc = i.doc
model = registry.tender_procurementMethodTypes.get(doc['procurementMethodType'])
if model:
tender = model(doc)
tender.__parent__ = root
doc = tender.to_primitive()
docs.append(doc)
try:
tender = model(doc)
tender.__parent__ = root
doc = tender.to_primitive()
except:
LOGGER.error("Failed migration of tender {} to schema 23.".format(doc['id']), extra={'MESSAGE_ID': 'migrate_data_failed', 'TENDER_ID': doc['id']})
else:
docs.append(doc)
if len(docs) >= 2 ** 7:
result = registry.db.update(docs)
docs = []
Expand Down

0 comments on commit 14c903d

Please sign in to comment.