Skip to content

Commit 8997ed8

Browse files
committed
random cleanup
1 parent 2308e3e commit 8997ed8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gcm/gcm.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ def construct_payload(self, registration_ids, data=None, collapse_key=None,
129129
"""
130130

131131
if time_to_live:
132-
if time_to_live > 2419200 or time_to_live < 0:
132+
four_weeks_in_secs = 2419200
133+
if not (0 <= time_to_live <= four_weeks_in_secs):
133134
raise GCMInvalidTtlException("Invalid time to live value")
134135

135136
if is_json:
@@ -147,7 +148,7 @@ def construct_payload(self, registration_ids, data=None, collapse_key=None,
147148
if delay_while_idle:
148149
payload['delay_while_idle'] = delay_while_idle
149150

150-
if time_to_live >= 0:
151+
if time_to_live:
151152
payload['time_to_live'] = time_to_live
152153

153154
if collapse_key:

0 commit comments

Comments
 (0)