http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10592
Revision: 10592 Author: xqt Date: 2012-10-20 13:23:12 +0000 (Sat, 20 Oct 2012) Log Message: ----------- better readability for wikidata action
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2012-10-20 05:14:10 UTC (rev 10591) +++ trunk/pywikipedia/wikipedia.py 2012-10-20 13:23:12 UTC (rev 10592) @@ -2028,7 +2028,7 @@
def _putPage(self, text, comment=None, watchArticle=False, minorEdit=True, newPage=False, token=None, newToken=False, sysop=False, - captcha=None, botflag=True, maxTries=-1,wikidata=False, labelwikidata=None, valuewikidata=None): + captcha=None, botflag=True, maxTries=-1, wikidata=False, labelwikidata=None, valuewikidata=None): """Upload 'text' as new content of Page by API
Don't use this directly, use put() instead. @@ -2049,10 +2049,11 @@ 'summary': self._encodeArg(comment, 'summary'), } if wikidata: - params['id']=self.title().replace(u"Q",u"") - params['action']='wbsetitem' - params['format']='jsonfm' - params['data']=u"{"labels":{""+labelwikidata+u"":{"language":""+labelwikidata+u"","value":""+valuewikidata+u""}}}" + params['id'] = self.title().replace(u"Q", u"") + params['action'] = 'wbsetitem' + params['format'] = 'jsonfm' + params['data'] = u'{"labels":{"%(label)s":{"language":"%(label)s","value":"%(value)s"}}}' \ + % {'label': labelwikidata, 'value': valuewikidata} if token: params['token'] = token else: