twitdao的一些改进

twitdao这个程序还是挺好用的。我做了一些修改,让它更适合我用一些。

  • 增加短地址还原
  • img.ly图片显示尺寸

一些代码:
templatetags/entities.py文件

_bitly = re.compile('http://bit\.ly/(?P[0-9a-zA-Z_\-]+)', re.I)
……
def image_preview(url):
''' show photo thumbnails '''
m=_bitly.search(url)
if m:
bitly_id=m.group('id')
try:
res=urlfetch.fetch('http://api.unshort.me/?r=http://bit.ly/%s&t=json' % bitly_id)
url_json = json.loads(res.content)

newurl = url_json['resolvedURL']
if newurl != "http://unshort.me":
return '%s' % (newurl,newurl)
except urlfetch.DownloadError:
return ''
……
return '<a href="%s" target="_blank"><img src="/i/imgly/%s/%s" /></a>' % ( url, 'medium', imgly_id )

[转载]WordPress 2.7 数据字典

原文链接:标点符 http://www.biaodianfu.com/wordpress-datebase.html

wp_comments

字段 类型 Null 默认 注释
comment_ID bigint(20) 评论ID
comment_post_ID int(11) 0 帖子ID
comment_author tinytext 用户名
comment_author_email varchar(100) 邮箱
comment_author_url varchar(200) 网址
comment_author_IP varchar(100) 用户IP
comment_date datetime 0000-00-00 00:00:00 评论时间
comment_date_gmt datetime 0000-00-00 00:00:00 评论gmt时间
comment_content text 评论内容
comment_karma int(11) 0 评论karma
comment_approved varchar(20) 1 评论审核
comment_agent varchar(255) 评论代理
comment_type varchar(20) 评论类型
comment_parent bigint(20) 0 评论上一级
user_id bigint(20) 0 用户ID

wp_links Continue reading