comparison MoinMoin/macro/EditTemplates.py @ 3229:09657fbd4aa2

converted to arg parser
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 09 Mar 2008 19:51:01 +0100
parents b06ef2a53efa
children 124d0ef138aa
comparison
equal deleted inserted replaced
3228:c7fabea3fb4f 3229:09657fbd4aa2
5 @copyright: 2004 Johannes Berg <johannes@sipsolutions.de> 5 @copyright: 2004 Johannes Berg <johannes@sipsolutions.de>
6 @license: GNU GPL, see COPYING for details. 6 @license: GNU GPL, see COPYING for details.
7 """ 7 """
8 8
9 Dependencies = ["language"] 9 Dependencies = ["language"]
10 10 def macro_EditTemplates(macro):
11 def execute(self, args):
12 result = '' 11 result = ''
13 # we don't want to spend much CPU for spiders requesting nonexisting pages 12 # we don't want to spend much CPU for spiders requesting nonexisting pages
14 if not self.request.isSpiderAgent: 13 if not macro.request.isSpiderAgent:
15 # Get list of template pages readable by current user 14 # Get list of template pages readable by current user
16 filterfn = self.request.cfg.cache.page_template_regex.search 15 filterfn = macro.request.cfg.cache.page_template_regex.search
17 templates = self.request.rootpage.getPageList(filter=filterfn) 16 templates = macro.request.rootpage.getPageList(filter=filterfn)
18 result = [] 17 result = []
19 if templates: 18 if templates:
20 templates.sort() 19 templates.sort()
21 page = self.formatter.page 20 page = macro.formatter.page
22 # send list of template pages 21 # send list of template pages
23 result.append(self.formatter.bullet_list(1)) 22 result.append(macro.formatter.bullet_list(1))
24 for template in templates: 23 for template in templates:
25 result.append(self.formatter.listitem(1)) 24 result.append(macro.formatter.listitem(1))
26 result.append(page.link_to(self.request, template, querystr={'action': 'edit', 'template': template})) 25 result.append(page.link_to(macro.request, template, querystr={'action': 'edit', 'template': template}))
27 result.append(self.formatter.listitem(0)) 26 result.append(macro.formatter.listitem(0))
28 result.append(self.formatter.bullet_list(0)) 27 result.append(macro.formatter.bullet_list(0))
29 result = ''.join(result) 28 result = ''.join(result)
30 return result 29 return result
31 30