给MoinMoin写插件

Thumbnail

1. 使用 MoinMoin 前些日子,我写了一篇使用MoinMoin作为个人KMS 大赞MoinMoin的各种好处。MoinMoin的其中一个好处是基于GPL的开源, 我们可以方便的给MoinMoin撰写自己的插件(当然也可以去官方的wiki上获取大量现成插件)。 MoinMoin开发者wiki地址 MoinMoin开发API文档(这个官方wiki居然很少提及) MoinMoin的多国语翻译组wiki地址 我在使用MoinMoi...

2012-02-10 · alswl

baidu ting下载音乐脚本

度娘终于干了一件好事,Baidu Ting上线了, 正版音乐免费下载,类似于谷歌音乐。 关于音乐版权和免费的问题, 有很多问题需要取讨论, 比如说这种商业模式是否对传统唱片业产生冲击又或是有积极影响? 作为普通消费者,暂时不用考虑这些问题,先享受这些服务好了。 Baidu Ting的音乐质量是128KBps,音质算好,里面的idv3信息也勉强可以,有: 歌名 歌手 部分专辑名(偶尔也出现"201-8月新歌快递&quo...

2012-01-03 · alswl

MoinMoin plugin: image2attach

Thumbnail

What’s this Image2Attach is a extension for MoinMoin. It can create a page action to save images from web to page’s attachments. Requirment MoinMoin 1.9 (I only test in this version.) Install copy action/Image2Attach.py to data/plugin/action/ restart python server Usage Go into a page, click more action - Image2Attach . It will take a while to fetch the images, after that it will save the image to attachments and replace the image’s link with attachment’s link. Finnally it will commit a change with message internet image save to attachment to wiki. Enjoy it, any bugs can report to Issue Report. Support You can get some develop infomation in Image2attach - Log4D Licence Distributed under the GPL v2 Source code powered by https://github.com/alswl/image2attach. update 2012-05-28 fix url catch bug(Issue 4 / Issue 6) 2011-12-25 support link([[http://xxx.com/xxx.jpg|) fix url has ‘attachment’ string bug. support image attachment rewrite.

2011-12-18 · alswl

dbevent2gc v0.1发布

Thumbnail

重要通知:Log4D的域名由 http://dddspace.com 迁移到 http://log4d.com 。 订阅地址现在改为 http://log4d.com/feed 和 http://feeds.feedburner.com/dddspace 。(FeedBurner的地址未发生变化) http://feed.dddspace.com 弃用 请订阅我博客的朋友更新一下订阅地址。 关于dbevent2gc A application to sync douban.com events to Google Calendar. dbevent2gc是一个GAE应用,它将豆瓣同城的活动同步到Google Calendar的日历, 允许用户订阅活动而知道最近几周周边将发生活动。 dbevent2gc是基于Python/web.py/mako/iC...

2011-11-25 · alswl

使用nose做测试

不做单元测试的程序员不是好程序员。最近我在Pylons下面做开发, 使用 nose 做单元测试,颇有心得, 在这里分享一下。 1. Pylons中依赖包 先简单介绍一下Pylons, Pylons与其说是一个框架,不如说是一堆框架的组合, Pylons在其中做到一个胶水的作用。Pylons依赖的包如下。 breaker,缓存和Session FormEncode,用户输入检查 Mako,模板渲染 nose,自动化测试 Paste,服...

2011-09-22 · alswl

TypeError: sequence item 22: expected string or Unicode, long found

Mako 下面开发时候,遇到这个问题 TypeError: sequence item : expected string or Unicode, long found Trace 的情况大概这样(我的错误信息无法再现,这是某位外国友人的错误信息) File ‘/Users/amaslov/Projects/dou-pylons/doupy/doupy/controllers/ root.py’, line 239 in staticpage return render(’/pages/%s.html’ % name) File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Pylons-0.9.7-py2.5.egg/pylons/templating.py’, line 274 in render_mako cache_type=cache_type, cache_expire=cache_expire) File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Pylons-0.9.7-py2.5.egg/pylons/templating.py’, line 249 in cached_template return render_func() File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Pylons-0.9.7-py2.5.egg/pylons/templating.py’, line 271 in render_template return literal(template.render_unicode(**globs)) File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Mako-0.2.4-py2.5.egg/mako/template.py’, line 138 in render_unicode return runtime.render(self, self.callable, args, data, as_unicode=True) File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Mako-0.2.4-py2.5.egg/mako/runtime.py’, line 348 in _render return context._pop_buffer().getvalue() File ‘/Users/amaslov/Projects/dou-pylons/py/lib/python2.5/site- packages/Mako-0.2.4-py2.5.egg/mako/util.py’, line 74 in getvalue return self.delim.join(self.data) TypeError: sequence item 68: expected string or Unicode, NoneType found Mako 的邮件列表曾在2009年遇到这个错误,讨论信息在[这里](http://www.mail-archive.com/pylon...

2011-08-25 · alswl

go-pylons.py在Python2.7下错误解决

当使用 Python2.7 + go-pylons.py 创建 Pylons 运行环境的话,会报一下错误。 [alswl@arch-vm xingtong]$ python go-pylons.py myb_env New python executable in myb_env/bin/python Traceback (most recent call last): File "/home/alswl/work/xingtong/myb_env/lib/python2.7/site.py", line 67, in <module> import os File "/home/alswl/work/xingtong/myb_env/lib/python2.7/os.py", line 398, in <module> import UserDict File "/home/alswl/work/xingtong/myb_env/lib/python2.7/UserDict.py", line 83, in <module> import _abcoll File "/home/alswl/work/xingtong/myb_env/lib/python2.7/_abcoll.py", line 11, in <module> from abc import ABCMeta, abstractmethod File "/home/alswl/work/xingtong/myb_env/lib/python2.7/abc.py", line 8, in <module> from _weakrefset import WeakSet ImportError: No module named _weakrefset ERROR: The executable myb_env/bin/python is not functioning ERROR: It thinks sys.prefix is '/home/alswl/work/xingtong' (should be '/home/alswl/work/xingtong/myb_env') ERROR: virtualenv is not compatible with this system or executable STFW 之后,找到了引发错误的根源virtualenv,这个 bug 在这里已经修复了。 #!diff --- a/virtualenv.py 2010-09-14 21:48:58.078562930 +0200 +++ b/virtualenv.py 2010-09-14 21:46:20.650769346 +0200 @@ -51,6 +51,8 @@ REQUIRED_FILES = ['lib-dynload', 'config if sys.version_info[:2] >= (2, 6): REQUIRED_MODULES.extend([‘warnings’, ’linecache’, ‘_abcoll’, ‘abc’]) if sys.version_info[:2] >= (2, 7): REQUIRED_MODULES.extend([’_weakrefset’]) if sys.version_info[:2] <= (2, 3): REQUIRED_MODULES.extend([‘sets’, ‘future’]) if is_pypy: 懒人可以点击...

2011-08-02 · alswl

urllib2.urlopen的中文URL问题

在url中使用中文其实是一个坏习惯,会带来一系列的转码问题, 我更喜欢英文译名或者id来标识某个uri。但是现实往往是残酷的, 特别是在我们调用别人服务时候,有时候被逼无奈使用中文URL。 Python中unicode转码一向是让人头疼的问题。数次碰壁之后,我也摸出了一些门道, 研读完Python字符串的encode与decode 之后,就自认为找到了万金油,谁知道这次又碰上这个老冤家。 Traceback (most recent call last): File "<stdin>", line 1, in...

2011-06-14 · alswl

一个mako.vim

给Vim找了一个Mako的语法高亮,发现着色居然有问题。查看更新记录后发现作者Armin Ronacher只更新到08年9月份。之后Mako更新了一些少许细节,我修改了一下mako.vim,放在这里供下载。 其实我只改了57/58行,增加一个block语法。 点击这里下载:mako.vim 使用方法,放入vimfiles/syntax 相关链接: 原始mako.vim:http://www.vim.org/s...

2011-06-09 · alswl

Eclipse中运行Pylons

Thumbnail

官方中pylons都是通过在shell中运行paster serve –reload development.ini来运行应用实例。而整天在任务栏跑着一个黑乎乎的shell很碍眼,通过一下步骤可以在Eclipse中运行pylons。 配置Run Configuration - Python Run如下。 Main页签中Main Module指向paster-script.py,可以使用绝对路径。 配置Arguments页签的参数,添加serve –reload development.i...

2011-05-16 · alswl