http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11778
Revision: 11778
Author: legoktm
Date: 2013-07-21 07:26:22 +0000 (Sun, 21 Jul 2013)
Log Message:
-----------
Prevent attempting of editing of Qualifier claims, and automatically add the lastrevid parameter
Modified Paths:
--------------
branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/site.py
===================================================================
--- branches/rewrite/pywikibot/site.py 2013-07-21 06:58:03 UTC (rev 11777)
+++ branches/rewrite/pywikibot/site.py 2013-07-21 07:26:22 UTC (rev 11778)
@@ -3443,7 +3443,7 @@
Sets the claim target to whatever claim.target is
An optional snaktype lets you set a novalue or somevalue.
"""
- if claim.isReference:
+ if claim.isReference or claim.isQualifier:
raise NotImplementedError
if not claim.snak:
#We need to already have the snak value
@@ -3458,10 +3458,7 @@
if snaktype == 'value':
params['value'] = json.dumps(claim._formatDataValue())
- for arg in kwargs:
- #TODO: Get the lastrevid from the item
- if arg in ['bot','lastrevid']:
- params[arg] = kwargs[arg]
+ params['lastrevid'] = claim.on_item.lastrevid
req = api.Request(site=self, **params)
data = req.submit()
return data
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11777
Revision: 11777
Author: legoktm
Date: 2013-07-21 06:58:03 +0000 (Sun, 21 Jul 2013)
Log Message:
-----------
Fix editAliases function, patch by Pyfisch
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2013-07-20 11:43:26 UTC (rev 11776)
+++ branches/rewrite/pywikibot/page.py 2013-07-21 06:58:03 UTC (rev 11777)
@@ -2262,7 +2262,6 @@
del self._link._title
return Page(self).title(**kwargs)
-
def __defined_by(self, singular=False):
"""
returns the parameters needed by the API to identify an item.
@@ -2436,6 +2435,8 @@
value should be a list of strings.
"""
aliases = self.__normalizeLanguages(aliases)
+ for (key, strings) in aliases.items():
+ aliases[key] = [{'language': key, 'value': i} for i in strings]
data = {'aliases': aliases}
self.editEntity(data, **kwargs)