djacobs / PyAPNs

Python library for interacting with the Apple Push Notification service (APNs)
http://pypi.python.org/pypi/apns/
MIT License
1.22k stars 377 forks source link

FIXED: Error while sending multicast without 'enhanced'. #148

Closed KartikeyaRokde closed 8 years ago

KartikeyaRokde commented 8 years ago

I have many token_hex in my database to which I want to send multicast. But it is possible to have invalid token_hex values (as I get them through an API), due to which I need to set enhanced = False in my code. Setting it to True stops sending the multicast without any Exception. So when enhanced = False, I get the error

AttributeError: 'GatewayConnection' object has no attribute '_sent_notifications' in sending multicast (send_notification_multiple) as _sent_notifications is not initialized when self.enhanced is not set to True in class GatewayConnection.

Fixed by putting self._sent_notifications initialization outside self.enhanced == True check in the GatewayConnection class.