diff --git a/apns2/payload.py b/apns2/payload.py index 98a3c10..052e5f0 100644 --- a/apns2/payload.py +++ b/apns2/payload.py @@ -43,8 +43,9 @@ class PayloadAlert(object): class Payload(object): - def __init__(self, alert=None, badge=None, sound=None, content_available=None, - mutable_content=False, category=None, custom=None): + def __init__(self, alert=None, badge=None, sound=None, + content_available=False, mutable_content=False, + category=None, custom=None): self.alert = alert self.badge = badge self.sound = sound @@ -57,22 +58,22 @@ class Payload(object): result = { 'aps': {} } - if self.alert: + if self.alert is not None: if isinstance(self.alert, PayloadAlert): result['aps']['alert'] = self.alert.dict() else: result['aps']['alert'] = self.alert - if self.badge: + if self.badge is not None: result['aps']['badge'] = self.badge - if self.sound: + if self.sound is not None: result['aps']['sound'] = self.sound if self.content_available: result['aps']['content-available'] = 1 if self.mutable_content: result['aps']['mutable-content'] = 1 - if self.category: + if self.category is not None: result['aps']['category'] = self.category - if self.custom: + if self.custom is not None: result.update(self.custom) return result