示例#1
0
def build_and_save_comment(web, site, episode):
        text, reply = md.convert(web.input('comment')), []
        def replyer(x):
            a = x.group()[1:]
            i = find(Comment.id).filter_by(author=a).order_by(Comment.date).all()
            if i: reply.append(i[-1][0])
            return i and '@<a href="/{0}/reply?{1}#new">{2}</a>'.\
                         format(site, i[-1][0], a)\
                     or "@{0}".format(a)
        text = re_reply.sub(replyer, text)
        if reply: reply = reply[0]
        else:     reply = -1
        if web.input('reply') != "-1":
            try: reply = int(web.input('reply'))
            except: pass
        cat = episode.category
        if "ds" in cat: cat = "datenspuren"
        pm_url = pentamediaportal + "/{0}/{1}".format(cat, episode.link)
        for link in re_url.finditer(web.input('comment')):
            trackback_client(link.group(), pm_url,
                             title   = episode.name,
                             excerpt = web.input('comment')
                            )
        Comment(episode = episode.id,
                author  = web.input('author'),
                reply   = reply,
                text    = text,
                date    = datetime.now()
               ).save()
        notify_muc("{0} just left some pithy words on {1}. [ {2} ]".\
            format(web.input('author'), episode.name, pm_url))
示例#2
0
 def send(self, filename, episode, link):
     response = trackback_client(link,
         pentamediaportal+"/{0}/{1}".\
         format(episode.category, episode.link),
         title = episode.name,
         excerpt = episode.short
                                )
     if response:
         response = response.replace(" ","")
         response = response.replace("\n","")
         response = response.lower()
         print(link, response)
         self.count.tb += 1
         if "<error>0</error>" in response:
             ShownoteTrackback(
                 filename = filename,
                 url      = link).add()
         else: self.count.error += 1