Closed toconnell closed 6 years ago
This is...still an issue, even after the monkey patch:
User OID: 56d2140a421aa90135fcebbf Method: POST URL: http://api.thewatcher.io/settlement/return_survivors/5ab808d68740d97083581189 JSON: {u'aftermath': u'defeat', u'serialize_on_response': True}
Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/toconnell/kdm-manager/v2/api/utils.py", line 516, in wrapped_function resp = make_response(f(*args, **kwargs)) File "/home/toconnell/kdm-manager/v2/api/api.py", line 274, in collection_action return asset_object.request_response(action) File "/home/toconnell/kdm-manager/v2/api/models/settlements.py", line 3996, in request_response self.return_survivors() File "/home/toconnell/kdm-manager/v2/api/models/settlements.py", line 1388, in return_survivors self.log_event(msg, event_type="survivors_return_%s" % aftermath) UnboundLocalError: local variable 'msg' referenced before assignment
Turns out this is customer-facing:
OK, this should be fixed:
@@ -1372,19 +1374,19 @@ class Settlement(Models.UserAsset):
for s in returned:
if not s.is_dead():
live_returns.append(s.survivor['name'])
-
+
+ msg = "Departing Survivors returend to the settlement in %s." % (aftermath)
if live_returns != []:
returners = utils.list_to_pretty_string(live_returns)
- msg = "Departing Survivors returend to the settlement in %s." % (aftermath)
- if showdown_type == 'normal':
- msg = "%s returned to the settlement in %s." % (returners, aftermath)
- elif showdown_type == 'special':
+ if showdown_type == 'special':
msg = "%s healed %s." % (request.User.login, returners)
+ else:
+ msg = "%s returned to the settlement in %s." % (returners, aftermath)
else:
- if showdown_type == 'normal':
- msg = "No survivors returned to the settlement."
- elif showdown_type == 'special':
+ if showdown_type == 'special':
msg = 'No survivors were healed after the Special Showdown.'
+ else:
+ msg = "No survivors returned to the settlement."
self.log_event(msg, event_type="survivors_return_%s" % aftermath)
Basically, we moved the "default" message (which should never make it to the logs) outside of the conditionals and made it so that Special Showdowns have unique handling and normal showdowns and Nemesis Encounters are handled via a big, blanket else
.
Fix goes out in the next release.