whitespaces are removed from mongo_id string and tested converting to ObjectId

This commit is contained in:
Jakub Trllo 2019-01-29 10:44:43 +01:00
parent df4f5b8b41
commit 83660c78de

View file

@ -177,6 +177,11 @@ def import_to_avalon(
return output
mongo_id = entity['custom_attributes'][ca_mongoid]
mongo_id = mongo_id.replace(' ', '').replace('\n', '')
try:
ObjectId(mongo_id)
except Exception:
mongo_id = ''
if mongo_id is not '':
avalon_asset = database[project_name].find_one(