::-- ZoomQuiet [2007-05-22 07:44:54]
Contents
1. 优化LikePages
根据 [修改Moin不查找带有日期的页面 http://my.opera.com/zhangyunfeng/blog/show.dml/411044]
升级 LikePage.py
1 # -*- coding: utf-8 -*-
2 """
3 MoinMoin - Create list of LikePages
4
5 @copyright: 2004 by Johannes Berg <[email protected]>
6 @license: GNU GPL, see COPYING for details.
7 070522 base http://my.opera.com/zhangyunfeng/blog/show.dml/411044 cancel date like page
8 """
9
10 Dependencies = ['namespace']
11
12 from MoinMoin.action import LikePages
13 import re
14 date = re.compile(r'\d{4}-\d{2}-\d{2}')
15
16 def execute(macro, args):
17 request = macro.request
18 pagename = macro.formatter.page.page_name
19
20 # 检查页面是否带有日期形式字符串
21 if re.search(date, pagename):
22 return 'Calendar Page will not be searched.'
23
24 # Get matches
25 start, end, matches = LikePages.findMatches(pagename, request)
26
27 # Render matches
28 if matches and not isinstance(matches, (str, unicode)):
29 return request.redirectedOutput(LikePages.showMatches, pagename, request, start, end, matches, False)
30
31 return args
加速创建文章时的相似页面列表行为