def run(self): log = logging.getLogger('pingback') log.debug('pinging directory %r' % self.directory_url) print 'pinging directory %r' % self.directory_url ping = DirectoryPing(object=self.instance, url=self.directory_url) try: server = ServerProxy(self.directory_url) try: q = server.weblogUpdates.extendedPing(self.site.name, self.blog_url, self.url, self.feed_url) #TODO: Find out name of exception :-) except Exception: try: q = server.weblogUpdates.ping(self.site.name, self.blog_url, self.url) except ProtocolError: log.exception('protocol error during directory ping %r' % self.directory_url) ping.success = False ping.save() if q.get('flerror'): ping.success = False log.error('flerror: %s' % q.get('message', 'no message')) else: ping.success = True except (IOError, ValueError, Fault, socket.error): log.exception('error during directory ping %r' % self.directory_url) ping.save()
def run (self): log = logging.getLogger('pingback') log.debug('pinging directory %r' % self.directory_url) print 'pinging directory %r' % self.directory_url ping = DirectoryPing(object=self.instance, url=self.directory_url) try: server = ServerProxy(self.directory_url) try: q = server.weblogUpdates.extendedPing(self.site.name, self.blog_url, self.url, self.feed_url) #TODO: Find out name of exception :-) except Exception: try: q = server.weblogUpdates.ping(self.site.name, self.blog_url, self.url) except ProtocolError: log.exception('protocol error during directory ping %r' % self.directory_url) ping.success = False ping.save() if q.get('flerror'): ping.success = False log.error('flerror: %s' % q.get('message', 'no message')) else: ping.success = True except (IOError, ValueError, Fault, socket.error): log.exception('error during directory ping %r' % self.directory_url) ping.save()
def execute_dirs_ping(instance, **kwargs): print "dupa pinguje!" log = logging.getLogger('pingback') log.debug('pinging directories') if not filtr(instance): return site = getattr(instance, 'site', Site.objects.get_current()) protocol = getattr(settings, 'SITE_PROTOCOL', 'http') url = maybe_call(getattr(instance, url_attr)) #feed_url = feed_url_fun(instance) domain = site.domain #feed_url = '%s://%s%s' % (protocol, domain, feed_url) #blog_url = '%s://%s/' % (protocol, domain) #url = urljoin(blog_url, url) feed_url = instance.get_feed_url blog_url = instance.user.get_absolute_url url = instance.get_absolute_url dir_urls = getattr(settings, 'DIRECTORY_URLS', []) #TODO: execute this code in the thread for directory_url in dir_urls: log.debug('pinging directory %r' % directory_url) ping = DirectoryPing(object=instance, url=directory_url) try: server = ServerProxy(directory_url) try: q = server.weblogUpdates.extendedPing( site.name, blog_url, url, feed_url) #TODO: Find out name of exception :-) except Exception: try: q = server.weblogUpdates.ping(site.name, blog_url, url) except ProtocolError: log.exception( 'protocol error during directory ping %r' % directory_url) ping.success = False ping.save() return execute_dirs_ping if q.get('flerror'): ping.success = False log.error('flerror: %s' % q.get('message', 'no message')) else: ping.success = True except (IOError, ValueError, Fault, socket.error): log.exception('error during directory ping %r' % directory_url) ping.save()
def ping_dirs(instance): site = getattr(instance, 'site', Site.objects.get_current()) feed_url = instance.get_feed_url() profile = instance.user.get_profile() blog_url = profile.get_absolute_url() url = instance.get_absolute_url() for directory_url in settings.DIRECTORY_URLS: log = logging.getLogger('pingback') log.debug('pinging directory %r' % directory_url) ping = DirectoryPing(object=instance, url=directory_url) try: server = ServerProxy(directory_url) try: q = server.weblogUpdates.extendedPing(site.name, blog_url, url, feed_url) #TODO: Find out name of exception :-) except Exception: try: q = server.weblogUpdates.ping(site.name, blog_url, url) except ProtocolError: log.exception('protocol error during directory ping %r' % directory_url) ping.success = False ping.save() if q is not None: if q.get('flerror'): ping.success = False log.error('flerror: %s' % q.get('message', 'no message')) else: ping.success = True else: ping.success = False except Exception: log.exception('error during directory ping %r' % directory_url) ping.success = False ping.save()
def execute_dirs_ping(instance, **kwargs): print "dupa pinguje!" log = logging.getLogger('pingback') log.debug('pinging directories') if not filtr(instance): return site = getattr(instance, 'site', Site.objects.get_current()) protocol = getattr(settings, 'SITE_PROTOCOL', 'http') url = maybe_call(getattr(instance, url_attr)) #feed_url = feed_url_fun(instance) domain = site.domain #feed_url = '%s://%s%s' % (protocol, domain, feed_url) #blog_url = '%s://%s/' % (protocol, domain) #url = urljoin(blog_url, url) feed_url = instance.get_feed_url blog_url = instance.user.get_absolute_url url = instance.get_absolute_url dir_urls = getattr(settings, 'DIRECTORY_URLS', []) #TODO: execute this code in the thread for directory_url in dir_urls: log.debug('pinging directory %r' % directory_url) ping = DirectoryPing(object=instance, url=directory_url) try: server = ServerProxy(directory_url) try: q = server.weblogUpdates.extendedPing(site.name, blog_url, url, feed_url) #TODO: Find out name of exception :-) except Exception: try: q = server.weblogUpdates.ping(site.name, blog_url, url) except ProtocolError: log.exception('protocol error during directory ping %r' % directory_url) ping.success = False ping.save() return execute_dirs_ping if q.get('flerror'): ping.success = False log.error('flerror: %s' % q.get('message', 'no message')) else: ping.success = True except (IOError, ValueError, Fault, socket.error): log.exception('error during directory ping %r' % directory_url) ping.save()