accept trackback

December 28th, 2008
Tags: GAE trackback micolog Posted in Python :-)Say something

It's not that fair only to trackback outside, but not accepting outside trackbacks. So I modified micolog to accept trackback.

No data model change is necessary as trackback is a type of comment, though a comment type field could be added as what Wordpress does. Only need to add a requestHandler to deal with trackback request.

Based on current micolog setup, I could add function to  the do_action handler (if you are not aware of that yet, try test this: http://cxu.yimudi.org/do/test ). But a separate handler is nicer as I can separate it into a module easily later. So I did that:

http://github.com/xclricky/micolog-cxu/commit/c95b17a3c1bcbf59fff27c1f091cd32c4ace5ea3#L1R395

And this handler will deal with any uri startswith "/trackback/"

 ('/trackback/(.*)', TrackBackHandler),

the stuff after 'trackback' is the real link to the target post. So in the handler, there are lots of checks, to check the post information is complete, to check the target post exists, to make sure the incoming link hasn't pinged before, etc.

But I also added some extra check, used some idea from Pingback (so what I implemented here is not an exact Trackback, which I hope can disappoint spam a bit), that is to check the incoming url exists or not and the content of incoming link has the target post url.

That's it. And let's see whether it works :)

Note, if you want to try to use it, please remember to update the template as well, since you need to add a trackback url for each of your post.

Update: it didn't work as I saved for the first try, because the urlfetch doesn't like non-ascii data, I have to add following to make it work:

result.content.decode('ascii','ignore')

 

 

Relate Posts:// 相关文章

what browser to use, if not firefox?»
«beautiful urls

“accept trackback” 共有3条留言

  1. Programming notes On

    Single threaded dev appserver...

    A while ago, I saw some discussion about using google appengine development server as a live (or production) web server, I forgot the conclusion (probably is no), I also found a reason to say no, when I was adding and testing the <a title="...

  2. wlsy On

    能让micolog接受traceback?如果那样就太好了。哦对了,ghs被万恶的GF。w封了,所以用代理才能访问你的站

  3. xclricky On

    竟然被封了?比较郁闷。
    恩,我给micolog增加了接受和发送trackback的功能,徐明兄可能什么时候会加入这些code吧,我的code也全放在github上了,可以看一下。

我要留言

6+8=