src/pyams_notify_ws/notify.py
changeset 8 a285b7e8217c
parent 1 f2910a60a29a
child 12 167cc4ab3313
--- a/src/pyams_notify_ws/notify.py	Thu Jun 01 16:45:38 2017 +0200
+++ b/src/pyams_notify_ws/notify.py	Wed Jul 12 12:14:20 2017 +0200
@@ -61,8 +61,10 @@
             action = message.get('action')
             if action == 'notify':
                 # dispatch notification to subscribers
-                json_message = json.dumps(message)
-                target = message.get('target').get('principals', ())
+                target = message.get('target', {}).get('principals', ())
+                clean_message = message.copy()
+                clean_message.pop('target')
+                json_message = json.dumps(clean_message)
                 for connection, subscription in users.items():
                     if subscription.filter_target(target):
                         yield from connection.send(json_message)