http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10704
Revision: 10704 Author: xqt Date: 2012-11-11 14:51:47 +0000 (Sun, 11 Nov 2012) Log Message: ----------- Fix for fileIsShared() and other methods: loadimageinfo must return the imageinfo. We take the top one.
Modified Paths: -------------- branches/rewrite/pywikibot/page.py branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/page.py =================================================================== --- branches/rewrite/pywikibot/page.py 2012-11-11 13:30:05 UTC (rev 10703) +++ branches/rewrite/pywikibot/page.py 2012-11-11 14:51:47 UTC (rev 10704) @@ -1538,7 +1538,7 @@ @deprecated("fileIsShared") def fileIsOnCommons(self): """Return True if the image is stored on Wikimedia Commons""" - return self.fileIsShared + return self.fileIsShared()
def fileIsShared(self): """Return True if image is stored on any known shared repository."""
Modified: branches/rewrite/pywikibot/site.py =================================================================== --- branches/rewrite/pywikibot/site.py 2012-11-11 13:30:05 UTC (rev 10703) +++ branches/rewrite/pywikibot/site.py 2012-11-11 14:51:47 UTC (rev 10704) @@ -52,7 +52,7 @@ NOT_LOGGED_IN = -1 AS_USER = 0 AS_SYSOP = 1 - + @classmethod def name(cls, search_value): for key, value in cls.__dict__.iteritems(): @@ -1136,7 +1136,8 @@ @param history: if true, return the image's version history
""" - args = {"title": page.title(withSection=False)} + title = page.title(withSection=False) + args = {"titles": title} if history: args["iilimit"] = "max" query = self._generator(api.PropertyGenerator, @@ -1148,11 +1149,11 @@ for pageitem in query: if pageitem['title'] != title: raise Error( - u"loadpageinfo: Query on %s returned data on '%s'" + u"loadimageinfo: Query on %s returned data on '%s'" % (page, pageitem['title'])) api.update_page(page, pageitem) - if history: - return pageitem['imageinfo'] + return pageitem['imageinfo'] \ + if history else pageitem['imageinfo'][0]
def page_exists(self, page): """Return True if and only if page is an existing page on site."""
pywikipedia-svn@lists.wikimedia.org