Commits

John Terry committed 6f4ab27

Only wrap the notifications_registry lookup in try block.

  • Participants
  • Parent commits 74c39e7

Comments (0)

Files changed (1)

 notifications_registry = {}
 
 def _action_callback(nid, action):
+        nid, action = int(nid), str(action)
     try:
-        nid, action = int(nid), str(action)
         n = notifications_registry[nid]
-        n._action_callback(action)
     except KeyError:
         #this message was created through some other program.
-        pass
+        return
+    n._action_callback(action)
 
 def _closed_callback(nid, reason):
+        nid, reason = int(nid), int(reason)
     try:
-        nid, reason = int(nid), int(reason)
         n = notifications_registry[nid]
-        n._closed_callback(n)
-        del notifications_registry[nid]
     except KeyError:
         #this message was created through some other program.
-        pass
+        return
+    n._closed_callback(n)
+    del notifications_registry[nid]
 
 def no_op(*args):
     """No-op function for callbacks.