jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/332333 )
Change subject: [IMPR] Polish WikidataBot.user_edit_entity
......................................................................
[IMPR] Polish WikidataBot.user_edit_entity
- Fix accessing WikibasePage.
- Make the method return bool, just like BaseBot._save_page does.
- Do not automatically set current_item, this shows ugly "-1" for new
items.
Bug: T87493
Change-Id: I91bf76085ce19bf191dcdbab73b2fb7c1b5bfac4
---
M pywikibot/bot.py
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 82f24ef..f35a785 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1313,7 +1313,7 @@
@rtype: bool
"""
if not self.user_confirm('Do you want to accept these changes?'):
- return
+ return False
if 'async' not in kwargs and self.getOption('always'):
kwargs['async'] = True
@@ -1871,16 +1871,16 @@
@kwarg ignore_save_related_errors: if True, errors related to
page save will be reported and ignored (default: False)
@type ignore_save_related_errors: bool
+ @return: whether the item was saved successfully
+ @rtype: bool
"""
- self.current_page = item
-
show_diff = kwargs.pop('show_diff', True)
if show_diff:
if data is None:
diff = item.toJSON(diffto=(
item._content if hasattr(item, '_content') else None))
else:
- diff = pywikibot.WikibasePage._normalizeData(data)
+ diff = pywikibot.page.WikibasePage._normalizeData(data)
pywikibot.output(json.dumps(diff, indent=4, sort_keys=True))
if 'summary' in kwargs:
@@ -1889,7 +1889,7 @@
# TODO async in editEntity should actually have some effect (bug T86074)
# TODO PageSaveRelatedErrors should be actually raised in editEntity
# (bug T86083)
- self._save_page(item, item.editEntity, data, **kwargs)
+ return self._save_page(item, item.editEntity, data, **kwargs)
def getSource(self, site):
"""
--
To view, visit
https://gerrit.wikimedia.org/r/332333
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I91bf76085ce19bf191dcdbab73b2fb7c1b5bfac4
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>