Skip to content
Snippets Groups Projects
Commit db6ddf8e authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-745: use safe get

parent 02087869
No related branches found
No related tags found
3 merge requests!634WIP: COBALT commissioning delta,!504TMSS-745: Responsive Telescope,!481Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
......@@ -228,7 +228,7 @@ class SchedulingUnitObservingStrategyTemplate(NamedVersionedCommon):
template_doc = deepcopy(self.template)
# loop over all tasks, and add the defaults to each task given the task's specifications_template
for task_name, task_doc in list(template_doc['tasks'].items()):
for task_name, task_doc in list(template_doc.get('tasks',{}).items()):
task_specifications_template = TaskTemplate.objects.get(name=task_doc['specifications_template'])
template_doc['tasks'][task_name] = add_defaults_to_json_object_for_schema(task_doc, task_specifications_template.schema,
cache=TemplateSchemaMixin._schema_cache, max_cache_age=TemplateSchemaMixin._MAX_SCHEMA_CACHE_AGE)
......@@ -244,7 +244,7 @@ class SchedulingUnitObservingStrategyTemplate(NamedVersionedCommon):
@property
def template_doc_with_just_the_parameters(self) -> dict:
parameter_pointers = sum([p['refs'] for p in self.template['parameters']], [])
parameter_pointers = sum([p['refs'] for p in self.template.get('parameters',[])], [])
template_doc = self.template_doc_complete_with_defaults
template_doc = subdict_of_pointer_items(template_doc, parameter_pointers)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment