comparison MoinMoin/themes/__init__.py @ 316:4ee796d759bf

use url_for_item where appropriate (in py code, no template changes yet) make url_for_item available for templates
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 05 Aug 2011 14:01:21 +0200
parents 8fa4a76d71ff
children 201758d56fb1
comparison
equal deleted inserted replaced
315:fed6024028b4 316:4ee796d759bf
178 178
179 # remove wiki: url prefix 179 # remove wiki: url prefix
180 if target.startswith("wiki:"): 180 if target.startswith("wiki:"):
181 target = target[5:] 181 target = target[5:]
182 182
183 # try handling interwiki links
184 wiki_name, item_name = split_interwiki(target) 183 wiki_name, item_name = split_interwiki(target)
184 if wiki_name == 'Self':
185 wiki_name = ''
185 href = url_for_item(item_name, wiki_name=wiki_name) 186 href = url_for_item(item_name, wiki_name=wiki_name)
186 if not is_local_wiki(wiki_name):
187 if not title:
188 title = item_name
189 return href, title, wiki_name
190
191 # Handle regular pagename like "FrontPage"
192 item_name = wikiutil.normalize_pagename(item_name, self.cfg)
193
194 if not title: 187 if not title:
195 title = item_name 188 title = item_name
196 href = url_for('frontend.show_item', item_name=item_name) 189 return href, title, wiki_name
197 return href, title, wiki_local
198 190
199 def navibar(self, item_name): 191 def navibar(self, item_name):
200 """ 192 """
201 Assemble the navibar 193 Assemble the navibar
202 194
385 'user': flaskg.user, 377 'user': flaskg.user,
386 'storage': flaskg.storage, 378 'storage': flaskg.storage,
387 'clock': flaskg.clock, 379 'clock': flaskg.clock,
388 'cfg': app.cfg, 380 'cfg': app.cfg,
389 'item_name': 'handlers need to give it', 381 'item_name': 'handlers need to give it',
382 'url_for_item': url_for_item,
390 'get_editor_info': lambda rev: get_editor_info(rev), 383 'get_editor_info': lambda rev: get_editor_info(rev),
391 'gen': make_generator(), 384 'gen': make_generator(),
392 }) 385 })
393 386