Skip to content

Commit e878848

Browse files
committed
apns: Fix bad reference to max notification size
Fixes #93 Thanks, Jay Camp
1 parent 036f396 commit e878848

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

push_notifications/apns.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ def _apns_send(token, alert, badge=None, sound=None, category=None, content_avai
135135
# convert to json, avoiding unnecessary whitespace with separators
136136
json_data = json.dumps(data, separators=(",", ":")).encode("utf-8")
137137

138-
if len(json_data) > settings.APNS_MAX_NOTIFICATION_SIZE:
139-
raise APNSDataOverflow("Notification body cannot exceed %i bytes" % (settings.APNS_MAX_NOTIFICATION_SIZE))
138+
max_size = SETTINGS["APNS_MAX_NOTIFICATION_SIZE"]
139+
if len(json_data) > max_size:
140+
raise APNSDataOverflow("Notification body cannot exceed %i bytes" % (max_size))
140141

141142
# if expiration isn't specified use 1 month from now
142143
expiration_time = expiration if expiration is not None else int(time.time()) + 2592000

0 commit comments

Comments
 (0)