Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Meant to use setdefault, not get. Whoops.

This fixes issues where a script might not get events if it was loaded too early.
  • Loading branch information...
commit 53bad542660ecc6df02626bbfe209bd71160d717 1 parent a462c02
@kg authored
Showing with 3 additions and 4 deletions.
  1. +2 −2 Common/common.service.py
  2. +1 −2  DroneHelper/dronehelper.py
View
4 Common/common.service.py
@@ -48,7 +48,7 @@ def forceStop(serviceName):
del runningServices[serviceName]
ne = getattr(serviceInstance, "__notifyevents__", [])
for evt in ne:
- nl = sm.notify.get(evt, [])
+ nl = sm.notify.setdefault(evt, list())
if serviceInstance in nl:
nl.remove(serviceInstance)
finally:
@@ -77,7 +77,7 @@ def forceStart(serviceName, serviceType):
if (not hasattr(result, evt)):
log("Missing event handler for %r on %r", evt, result)
else:
- nl = sm.notify.get(evt, [])
+ nl = sm.notify.setdefault(evt, list())
nl.append(result)
return result
View
3  DroneHelper/dronehelper.py
@@ -87,7 +87,6 @@ class DroneHelperSvc:
def __init__(self):
self.__drones = {}
self.__pendingStateChanges = {}
- self.__updateTimer = None
self.__lastAttackOrder = None
self.__recalling = set()
self.__recalled = []
@@ -473,7 +472,7 @@ def getDroneObject(self, droneID):
drone = DroneInfo(droneID)
self.__drones[droneID] = drone
- return drone
+ return drone
def OnDroneStateChange2(self, droneID, oldActivityState, newActivityState, timestamp=None):
if not timestamp:
Please sign in to comment.
Something went wrong with that request. Please try again.