Revision: 5017 Author: rotem Date: 2008-02-14 17:22:58 +0000 (Thu, 14 Feb 2008)
Log Message: ----------- Don't encode the title if it contains wiki syntax, but only the wiki syntax itself.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-02-14 07:35:13 UTC (rev 5016) +++ trunk/pywikipedia/wikipedia.py 2008-02-14 17:22:58 UTC (rev 5017) @@ -442,18 +442,12 @@ """Return the title of this Page, as a Unicode string.
If underscore is True, replace all ' ' characters with '_'. - If savetitle is True, try to quote all non-ASCII characters. + If savetitle is True, encode any wiki syntax in the title. """ title = self._title - if savetitle: # Ensure there's no wiki syntax in the title - # FIXME: this makes no sense - if title.find("''") > -1: - try: - title = urllib.quote(title).replace('%20',' ') - except KeyError: - # We can't encode everything; to be on the safe side, - # we encode nothing - pass + if savetitle: + # Ensure there's no wiki syntax in the title + title = title.replace(u"''", u'%27%27') if underscore: title = title.replace(' ', '_') return title @@ -506,7 +500,7 @@ If textlink is True, always return a link in text form (that is, links to the Category: and Image: namespaces will be preceded by a : character). (Not needed if forceInterwiki is True.) - + """ if not noInterwiki and (forceInterwiki or self.site() != getSite()): if self.site().family != getSite().family \