pep8: Add compliance with rule E261 to push_notifications.py.

This commit is contained in:
Aditya Bansal
2017-05-07 20:38:46 +05:30
committed by Tim Abbott
parent d561c758cd
commit 69cf11d786

View File

@@ -35,15 +35,15 @@ from functools import partial
# APNS error codes # APNS error codes
ERROR_CODES = { ERROR_CODES = {
1: 'Processing error', 1: 'Processing error',
2: 'Missing device token', # looks like token was empty? 2: 'Missing device token', # looks like token was empty?
3: 'Missing topic', # topic is encoded in the certificate, looks like certificate is wrong. bail out. 3: 'Missing topic', # topic is encoded in the certificate, looks like certificate is wrong. bail out.
4: 'Missing payload', # bail out, our message looks like empty 4: 'Missing payload', # bail out, our message looks like empty
5: 'Invalid token size', # current token has wrong size, skip it and retry 5: 'Invalid token size', # current token has wrong size, skip it and retry
6: 'Invalid topic size', # can not happen, we do not send topic, it is part of certificate. bail out. 6: 'Invalid topic size', # can not happen, we do not send topic, it is part of certificate. bail out.
7: 'Invalid payload size', # our payload is probably too big. bail out. 7: 'Invalid payload size', # our payload is probably too big. bail out.
8: 'Invalid token', # our device token is broken, skipt it and retry 8: 'Invalid token', # our device token is broken, skipt it and retry
10: 'Shutdown', # server went into maintenance mode. reported token is the last success, skip it and retry. 10: 'Shutdown', # server went into maintenance mode. reported token is the last success, skip it and retry.
None: 'Unknown', # unknown error, for sure we try again, but user should limit number of retries None: 'Unknown', # unknown error, for sure we try again, but user should limit number of retries
} }
redis_client = get_redis_client() redis_client = get_redis_client()
@@ -323,7 +323,7 @@ def handle_push_notification(user_profile_id, missed_message):
'user': user_profile.email, 'user': user_profile.email,
'event': 'message', 'event': 'message',
'alert': alert, 'alert': alert,
'zulip_message_id': message.id, # message_id is reserved for CCS 'zulip_message_id': message.id, # message_id is reserved for CCS
'time': datetime_to_timestamp(message.pub_date), 'time': datetime_to_timestamp(message.pub_date),
'content': content, 'content': content,
'content_truncated': content_truncated, 'content_truncated': content_truncated,