Exit without exception if this APNS attempt has no connection

(imported from commit bbdd9f3e11946739459f34b2580e4a7371b158a0)
This commit is contained in:
Leo Franchi
2015-02-11 07:20:51 +00:00
parent d865732e0d
commit 0ae8e28635

View File

@@ -39,6 +39,10 @@ def hex_to_b64(data):
return base64.b64encode(binascii.unhexlify(data))
def _do_push_to_apns_service(user, message, apns_connection):
if not apns_connection:
logging.info("Not delivering APNS message %s to user %s due to missing connection" % (message, user))
return
apns_client = APNs(apns_connection)
ret = apns_client.send(message)
if not ret: