def action_trackback_ping(self): tbUrl=self.param('tbUrl') title=self.param('title') excerpt=self.param('excerpt') url=self.param('url') blog_name=self.param('blog_name') tb=TrackBack(tbUrl,title,excerpt,url,blog_name) tb.ping()
def publish(self,newval=True): if newval: if not self.is_saved(): self.save() if not self.is_wp: self.post_id=self.key().id() #fix for old version if not self.postname: self.setpostname(self.slug) vals={'year':self.date.year,'month':str(self.date.month).zfill(2),'day':self.date.day, 'postname':self.postname,'post_id':self.post_id} if self.entrytype=='page': if self.slug: self.link=self.postname else: self.link='?p=%(post_id)s'%vals else: if g_blog.link_format and self.postname: self.link=g_blog.link_format.strip()%vals else: self.link='?p=%(post_id)s'%vals if not self.published: g_blog.entrycount+=1 to_ping = 1 else: to_ping = 0 self.published=True g_blog.save() self.save() if to_ping: urls = url_regex.findall(self.content) logging.info(urls) if len(urls) > 0: urls = set(urls) from app.trackback import TrackBack tb = TrackBack(title=self.title, excerpt=self.get_content_excerpt()[:250], url=self.fullurl(), blog_name=g_blog.title) for url in urls: resp = tb.ping(url) if resp: logging.info(resp) else: self.published=false if self.published: g_blog.entrycount-=1 g_blog.save() self.save() self.removecache() if g_blog.sitemap_ping: Sitemap_NotifySearch()