Ejemplo n.º 1
0
 def unsubscribefeed(self, message):
     msg =  'listener.unsubscribefeed: msg received: ' + str(message)
     self.logger.debug(msg)
     # Dont try to instantiate googleprofileid, probably is already deleted
     try:
         pushsubid, googleprofileid = message.split('__')
         pushsub = PushSubscription.objects.get(id = int(pushsubid))
         callback_url = 'http://%s%s' % (Site.objects.get_current(),
                                         reverse('pubsubcallback', args=[googleprofileid]))
             
         # Async unsubscription request; the server will reply later calling the callback and from there
         # the subscription will be deleted
         subscribe_feed(pushsub.topic_url, callback_url, subscribe=False)
     except Exception, e:
         self.logger.error('Exception on unsubscribefeed: ')
         self.logger.error(format_exc())
Ejemplo n.º 2
0
    def unsubscribefeed(self, message):
        msg = 'listener.unsubscribefeed: msg received: ' + str(message)
        self.logger.debug(msg)
        # Dont try to instantiate googleprofileid, probably is already deleted
        try:
            pushsubid, googleprofileid = message.split('__')
            pushsub = PushSubscription.objects.get(id=int(pushsubid))
            callback_url = 'http://%s%s' % (Site.objects.get_current(),
                                            reverse('pubsubcallback',
                                                    args=[googleprofileid]))

            # Async unsubscription request; the server will reply later calling the callback and from there
            # the subscription will be deleted
            subscribe_feed(pushsub.topic_url, callback_url, subscribe=False)
        except Exception, e:
            self.logger.error('Exception on unsubscribefeed: ')
            self.logger.error(format_exc())
Ejemplo n.º 3
0
            subscription = subscriptions[0]
            subscription.topic_url = topic_url
            subscription.googleprof = googleprofile
            subscription.renewed_at = datetime.now()
        else:
            subscription = PushSubscription(confirmed=False,
                                            topic_url=topic_url,
                                            googleprofile=googleprof,
                                            renewed_at=datetime.now())

        # Async subscription request; the server will reply later calling the callback and from there
        # the subscription will be considered enabled
        self.logger.debug('Subscribing user: %s' % googleprof.username)
        self.logger.debug('To topic URL: %s' % topic_url)
        self.logger.debug('Using callback: %s' % callback_url)
        subscribe_feed(topic_url, callback_url, subscribe=True)
        subscription.save()

    def unsubscribefeed(self, message):
        msg = 'listener.unsubscribefeed: msg received: ' + str(message)
        self.logger.debug(msg)
        # Dont try to instantiate googleprofileid, probably is already deleted
        try:
            pushsubid, googleprofileid = message.split('__')
            pushsub = PushSubscription.objects.get(id=int(pushsubid))
            callback_url = 'http://%s%s' % (Site.objects.get_current(),
                                            reverse('pubsubcallback',
                                                    args=[googleprofileid]))

            # Async unsubscription request; the server will reply later calling the callback and from there
            # the subscription will be deleted
Ejemplo n.º 4
0
         subscription = subscriptions[0]
         subscription.topic_url = topic_url
         subscription.googleprof = googleprofile
         subscription.renewed_at = datetime.now()
     else:
         subscription = PushSubscription(confirmed=False,
                                         topic_url=topic_url,
                                         googleprofile=googleprof,
                                         renewed_at=datetime.now())
         
     # Async subscription request; the server will reply later calling the callback and from there
     # the subscription will be considered enabled
     self.logger.debug('Subscribing user: %s' % googleprof.username)
     self.logger.debug('To topic URL: %s' % topic_url)
     self.logger.debug('Using callback: %s' % callback_url)
     subscribe_feed(topic_url, callback_url, subscribe=True)
     subscription.save()
     
     
 def unsubscribefeed(self, message):
     msg =  'listener.unsubscribefeed: msg received: ' + str(message)
     self.logger.debug(msg)
     # Dont try to instantiate googleprofileid, probably is already deleted
     try:
         pushsubid, googleprofileid = message.split('__')
         pushsub = PushSubscription.objects.get(id = int(pushsubid))
         callback_url = 'http://%s%s' % (Site.objects.get_current(),
                                         reverse('pubsubcallback', args=[googleprofileid]))
             
         # Async unsubscription request; the server will reply later calling the callback and from there
         # the subscription will be deleted