http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11056
Revision: 11056 Author: xqt Date: 2013-02-09 13:41:50 +0000 (Sat, 09 Feb 2013) Log Message: ----------- Enable id number for creating a DataPage Object; replace underscores with dash when converting a dbname to a site code
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2013-02-08 14:43:56 UTC (rev 11055) +++ trunk/pywikipedia/wikipedia.py 2013-02-09 13:41:50 UTC (rev 11056) @@ -4084,6 +4084,9 @@ elif isinstance(source, Page): title = source.title() source = source.site + elif isinstance(source, int): + title = "Q%d" % source + source = getSite().data_repository() self._originSite = source self._originTitle = title source = self._originSite.data_repository() @@ -4366,7 +4369,7 @@ except AttributeError: raise SectionError # Page has no section by this name self._contents = json.loads(pagetext) - self._title = self._contents['entity'] + self._title = self._contents['entity'].title() return self._contents
def getentities(self, sysop=False): @@ -4439,7 +4442,8 @@
""" links = self.get()['links'] - self._interwiki = [Page(code.replace('wiki', ''), links[code]) + self._interwiki = [Page(code.replace('wiki', '').replace('_', '-'), + links[code]) for code in links] return self._interwiki