src/pyams_notify_ws/notify.py
changeset 8 a285b7e8217c
parent 1 f2910a60a29a
child 12 167cc4ab3313
equal deleted inserted replaced
7:d3490a8d7272 8:a285b7e8217c
    59             pass
    59             pass
    60         else:
    60         else:
    61             action = message.get('action')
    61             action = message.get('action')
    62             if action == 'notify':
    62             if action == 'notify':
    63                 # dispatch notification to subscribers
    63                 # dispatch notification to subscribers
    64                 json_message = json.dumps(message)
    64                 target = message.get('target', {}).get('principals', ())
    65                 target = message.get('target').get('principals', ())
    65                 clean_message = message.copy()
       
    66                 clean_message.pop('target')
       
    67                 json_message = json.dumps(clean_message)
    66                 for connection, subscription in users.items():
    68                 for connection, subscription in users.items():
    67                     if subscription.filter_target(target):
    69                     if subscription.filter_target(target):
    68                         yield from connection.send(json_message)
    70                         yield from connection.send(json_message)
    69                 # store message in memcached_queue
    71                 # store message in memcached_queue
    70                 if cache_handler is not None:
    72                 if cache_handler is not None: