From 7face5704bef17221bb164850c1fa6415f31fbd8 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 16 Jun 2011 23:10:29 +0800 Subject: [PATCH] =?utf8?q?=E6=9B=B4=E6=96=B0=20paste=20=E7=BD=91=E7=AB=99?= =?utf8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- gaetalk.py | 2 +- utils.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gaetalk.py b/gaetalk.py index 661a007..b1d973e 100755 --- a/gaetalk.py +++ b/gaetalk.py @@ -185,7 +185,7 @@ def handle_message(msg): if len(msg.body) > 500 or msg.body.count('\n') > 5: msgbody = utils.post_code(msg.body) if msgbody: - msg.reply(u'内容过长,已贴至 %s' % msgbody) + msg.reply(u'内容过长,已贴至 %s 。在其后附加 “/lang”来查看语法高亮版' % msgbody) else: logging.warn(u'贴代码失败,代码长度 %d' % len(msg.body)) msg.reply('由于技术限制,每条消息最长为 500 字。大段文本请贴 paste 网站。\n' diff --git a/utils.py b/utils.py index a85536e..9a96b30 100755 --- a/utils.py +++ b/utils.py @@ -103,11 +103,10 @@ class MemLock: def post_code(msg): '''将代码贴到网站,返回 URL 地址 或者 None(失败)''' form_data = urllib.urlencode({ - 'sprunge': msg.encode('utf-8'), - 'lang': 'auto', + 'vimcn': msg.encode('utf-8'), }) try: - result = urlfetch.fetch(url='http://paste.vim-cn.co.cc/', + result = urlfetch.fetch(url='http://p.vim-cn.com/', payload=form_data, method=urlfetch.POST, headers={'Content-Type': 'application/x-www-form-urlencoded'}) -- 2.11.4.GIT