Commits

Etienne Perot committed cf2c93b

Support possibly-URL-encoded page titles, which are valid wiki markup in links but wikitools doesn't like them very much

  • Participants
  • Parent commits 4474f20

Comments (0)

Files changed (1)

 	if type(p) in (type(''), type(u'')):
 		p = u(p)
 		if p not in config['runtime']['pages']:
-			config['runtime']['pages'][p] = wikitools.page.Page(wiki(), p, followRedir=False)
+			try:
+				config['runtime']['pages'][p] = wikitools.page.Page(wiki(), p, followRedir=False)
+			except wikitools.page.BadTitle:
+				# Try URL-decoding the title
+				config['runtime']['pages'][p] = wikitools.page.Page(wiki(), urllib2.unquote(p), followRedir=False)
 		return config['runtime']['pages'][p]
 	# Else, it is a page object
 	title = u(p.title)