Closed toconnell closed 7 years ago
I'm gonna hack around this with a quick backoff to name:
1462 def get_innovations(self, return_type=None, include_principles=False):
1463 """ Returns self.settlement["innovations"] by default; specify 'dict' as
1464 the 'return_type' to get a dictionary back instead. """
1465
1466 s_innovations = copy(self.settlement["innovations"])
1467 if include_principles:
1468 s_innovations.extend(self.settlement["principles"])
1469
1470 I = innovations.Assets()
1471
1472 if return_type == dict:
1473 output = {}
1474 for i_handle in s_innovations:
1475 i_dict = I.get_asset(i_handle, backoff_to_name=True)
1476 if i_dict is not None:
1477 output[i_handle] = i_dict
1478 else:
1479 self.logger.error("Ignoring unknown Innovation handle '%s'!" % i_handle)
1480 return output
1481
1482 return s_innovations
...and now we're throwing a traceback when we try to load parents that don't exist...
Hack around it!
diff --git a/v2/api/models/survivors.py b/v2/api/models/survivors.py
index c0c572f..d4be1ff 100644
--- a/v2/api/models/survivors.py
+++ b/v2/api/models/survivors.py
@@ -1711,12 +1711,13 @@ class Survivor(Models.UserAsset):
output = {'mother': None, 'father': None}
for p_oid in parents:
p = utils.mdb.survivors.find_one({'_id': p_oid})
- if p["sex"] == 'M':
- output['father'] = p
- elif p['sex'] == 'F':
- output['mother'] = p
- else:
- raise
+ if p is not None:
+ if p["sex"] == 'M':
+ output['father'] = p
+ elif p['sex'] == 'F':
+ output['mother'] = p
+ else:
+ raise
return output
return parents
OK, this seems like it's resolved, so I'm closing it and it will go out in the next release.
Gnarly: