comparison MoinMoin/macro/__init__.py @ 1920:b06ef2a53efa

'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 30 Mar 2007 21:50:50 +0200
parents bb2e053067fb
children 5dc0896d145a
comparison
equal deleted inserted replaced
1919:5abc7d1528d5 1920:b06ef2a53efa
138 macro_name, 'Dependencies') 138 macro_name, 'Dependencies')
139 except wikiutil.PluginError: 139 except wikiutil.PluginError:
140 return self.defaultDependency 140 return self.defaultDependency
141 141
142 def _macro_TitleSearch(self, args): 142 def _macro_TitleSearch(self, args):
143 from FullSearch import search_box 143 from MoinMoin.search.FullSearch import search_box
144 return search_box("titlesearch", self) 144 return search_box("titlesearch", self)
145 145
146 def _macro_GoTo(self, args): 146 def _macro_GoTo(self, args):
147 """ Make a goto box 147 """ Make a goto box
148 148
180 allpages = int(self.form.get('allpages', [0])[0]) != 0 180 allpages = int(self.form.get('allpages', [0])[0]) != 0
181 # Get page list readable by current user, filter by isSystemPage if needed 181 # Get page list readable by current user, filter by isSystemPage if needed
182 if allpages: 182 if allpages:
183 pages = request.rootpage.getPageList() 183 pages = request.rootpage.getPageList()
184 else: 184 else:
185 def filter(name): 185 def nosyspage(name):
186 return not wikiutil.isSystemPage(request, name) 186 return not wikiutil.isSystemPage(request, name)
187 pages = request.rootpage.getPageList(filter=filter) 187 pages = request.rootpage.getPageList(filter=nosyspage)
188 188
189 word_re = re.compile(word_re, re.UNICODE) 189 word_re = re.compile(word_re, re.UNICODE)
190 map = {} 190 wordmap = {}
191 for name in pages: 191 for name in pages:
192 for word in word_re.findall(name): 192 for word in word_re.findall(name):
193 try: 193 try:
194 if not map[word].count(name): 194 if not wordmap[word].count(name):
195 map[word].append(name) 195 wordmap[word].append(name)
196 except KeyError: 196 except KeyError:
197 map[word] = [name] 197 wordmap[word] = [name]
198 198
199 # Sort ignoring case 199 # Sort ignoring case
200 tmp = [(word.upper(), word) for word in map] 200 tmp = [(word.upper(), word) for word in wordmap]
201 tmp.sort() 201 tmp.sort()
202 all_words = [item[1] for item in tmp] 202 all_words = [item[1] for item in tmp]
203 203
204 index_letters = [] 204 index_letters = []
205 current_letter = None 205 current_letter = None
278 def _macro_InterWiki(self, args): 278 def _macro_InterWiki(self, args):
279 from StringIO import StringIO 279 from StringIO import StringIO
280 interwiki_list = wikiutil.load_wikimap(self.request) 280 interwiki_list = wikiutil.load_wikimap(self.request)
281 buf = StringIO() 281 buf = StringIO()
282 buf.write('<dl>') 282 buf.write('<dl>')
283 list = interwiki_list.items() # this is where we cached it 283 iwlist = interwiki_list.items() # this is where we cached it
284 list.sort() 284 iwlist.sort()
285 for tag, url in list: 285 for tag, url in iwlist:
286 buf.write('<dt><tt><a href="%s">%s</a></tt></dt>' % ( 286 buf.write('<dt><tt><a href="%s">%s</a></tt></dt>' % (
287 wikiutil.join_wiki(url, 'RecentChanges'), tag)) 287 wikiutil.join_wiki(url, 'RecentChanges'), tag))
288 if '$PAGE' not in url: 288 if '$PAGE' not in url:
289 buf.write('<dd><tt><a href="%s">%s</a></tt></dd>' % (url, url)) 289 buf.write('<dd><tt><a href="%s">%s</a></tt></dd>' % (url, url))
290 else: 290 else:
401 def _macro_Anchor(self, args): 401 def _macro_Anchor(self, args):
402 return self.formatter.anchordef(args or "anchor") 402 return self.formatter.anchordef(args or "anchor")
403 403
404 def _macro_MailTo(self, args): 404 def _macro_MailTo(self, args):
405 from MoinMoin.mail.sendmail import decodeSpamSafeEmail 405 from MoinMoin.mail.sendmail import decodeSpamSafeEmail
406 result='' 406 result = ''
407 args = args or '' 407 args = args or ''
408 if ',' not in args: 408 if ',' not in args:
409 email = args 409 email = args
410 text = '' 410 text = ''
411 else: 411 else: