Open robnagler opened 1 year ago
prepare_for_save should get deleted. It is trying to what prepare_for_client is doing, but it does it incorrectly. prepare_for_client will be called at the end of the importFile API. Related #6526
prepare_for_save can't be deleted at this stage. #6526 will do this. For now, just fixing prepare_for_save
Working #5198 which changes the way saves happen. In the current srw.import_file, the import of
import_data/srw_6.py
produces a result that is invalid:models.electronBeam
does not have anid
. There is an ad hoc fixup that happens at the end via a call_api of simulationData. The data has already been saved withmodified
set to false, which if true, would fail here in srw.prepare_for_save. That is, the data on disk (in sirepo-data.json) is invalid at this point but the call tosimulationData
fixes it up via a call to prepare_for_client, which callssave_simulation_json
.In the new model, it's just like the other imports and
_save_new_and_reply
is called, which blows up, because prepare_for_client is not called.I think prepare_for_client is implemented incorrectly. First, template.srw is the only template that calls save_simulation_json, which means it is out of line with other templates. Second, the work of fixing up the models should be done in prepare_for_save, not prepare_for_client.