jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/322398 )
Change subject: Workaround for T111513
......................................................................
Workaround for T111513
It is wasteful to interrupt the bot just because of an unsupported
interwiki link. Here, we only test if it *is* an interwiki link, then we
skip it whatever syntax it has. This error only confirms that.
Bug: T136280
Change-Id: If013e15e4282fd29ef6f0f81e8c6f984d7fde70e
---
M pywikibot/cosmetic_changes.py
1 file changed, 6 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 6f4bfac..0e52a83 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -450,7 +450,12 @@
trailingChars = match.group('linktrail')
newline = match.group('newline')
- if not self.site.isInterwikiLink(titleWithSection):
+ try:
+ is_interwiki = self.site.isInterwikiLink(titleWithSection)
+ except ValueError: # T111513
+ is_interwiki = True
+
+ if not is_interwiki:
# The link looks like this:
# [[page_title|link_text]]trailing_chars
# We only work on namespace 0 because pipes and linktrails work
--
To view, visit https://gerrit.wikimedia.org/r/322398
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If013e15e4282fd29ef6f0f81e8c6f984d7fde70e
Gerrit-PatchSet: 7
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: Sn1per <geofbot(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/336229 )
Change subject: [DOC] Doc string for -always option
......................................................................
[DOC] Doc string for -always option
- There is an inverse logic for the -always option:
Don't ask for confirmation when putting a page
when option is set but ask by default.
Change-Id: I524f7c5142844dd8794abe6228f3a12986f25510
---
M pywikibot/bot.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 82f24ef..4a5bd3e 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1150,7 +1150,7 @@
# The values are the default values
# Extend this in subclasses!
availableOptions = {
- 'always': False, # ask for confirmation when putting a page?
+ 'always': False, # By default ask for confirmation when putting a page
}
_current_page = None
--
To view, visit https://gerrit.wikimedia.org/r/336229
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I524f7c5142844dd8794abe6228f3a12986f25510
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/336983 )
Change subject: checkimages: Add a paramater of maximum number of notifications per user per check
......................................................................
checkimages: Add a paramater of maximum number of notifications per user per check
On commons, batch uploads are fairly frequent, we do not wish to flood
a user's email inboxes just because they forgot to add a few characters
to the file description pages. By adding this limit, the severeness of
email flooding can be greatly reduced, and a few talk page notifications
is usually enough to let batch uploaders know about their issue.
Bug: T157728
Change-Id: I9e25b35d42af3c73c581c6d05a6a4a8dc8ef62c6
---
M scripts/checkimages.py
1 file changed, 28 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 40ad67a..d4207a7 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -25,6 +25,9 @@
-duplicatesreport Report the duplicates in a log *AND* put the template in
the images.
+-maxusernotify Maximum nofitications added to a user talk page in a single
+ check, to avoid email spamming.
+
-sendemail Send an email after tagging.
-break To break the bot after the first check (default: recursive)
@@ -88,6 +91,7 @@
__version__ = '$Id$'
#
+import collections
import re
import time
@@ -543,7 +547,7 @@
"""A robot to check recently uploaded files."""
def __init__(self, site, logFulNumber=25000, sendemailActive=False,
- duplicatesReport=False, logFullError=True):
+ duplicatesReport=False, logFullError=True, max_user_notify=None):
"""Constructor, define some global variable."""
self.site = site
self.logFullError = logFullError
@@ -570,6 +574,11 @@
self.sendemailActive = sendemailActive
self.skip_list = []
self.duplicatesReport = duplicatesReport
+
+ if max_user_notify:
+ self.num_notify = collections.defaultdict(lambda: max_user_notify)
+ else:
+ self.num_notify = None
self.image_namespace = u"File:"
# Load the licenses only once, so do it once
@@ -767,10 +776,18 @@
newText = '{0}\n\n== {1} ==\n{2}'.format(testoattuale, self.head,
self.notification)
+ # Check maximum number of notifications for this talk page
+ if (self.num_notify is not None and
+ not self.num_notify[self.talk_page.title()]):
+ pywikibot.output('Maximum notifications reached, skip.')
+ return
+
try:
self.talk_page.put(newText, summary=commentox, minorEdit=False)
except pywikibot.LockedPage:
pywikibot.output(u'Talk page blocked, skip.')
+ else:
+ self.num_notify[self.talk_page.title()] -= 1
if emailPageName and emailSubj:
emailPage = pywikibot.Page(self.site, emailPageName)
@@ -1592,6 +1609,7 @@
regexGen = False # Use the regex generator
duplicatesActive = False # Use the duplicate option
duplicatesReport = False # Use the duplicate-report option
+ max_user_notify = None
sendemailActive = False # Use the send-email
logFullError = True # Raise an error when the log is full
generator = None
@@ -1634,6 +1652,13 @@
duplicates_rollback = 1
elif len(arg) > 11:
duplicates_rollback = int(arg[12:])
+ elif arg.startswith('-maxusernotify'):
+ if len(arg) == 13:
+ max_user_notify = int(pywikibot.input(
+ 'What should be the maximum number of notifications per '
+ 'user per check?'))
+ elif len(arg) > 13:
+ max_user_notify = int(arg[14:])
elif arg == '-sendemail':
sendemailActive = True
elif arg.startswith('-skip'):
@@ -1727,7 +1752,8 @@
# Defing the Main Class.
Bot = checkImagesBot(site, sendemailActive=sendemailActive,
duplicatesReport=duplicatesReport,
- logFullError=logFullError)
+ logFullError=logFullError,
+ max_user_notify=max_user_notify)
if normal:
generator = pg.NewimagesPageGenerator(total=limit, site=site)
# if urlUsed and regexGen, get the source for the generator
--
To view, visit https://gerrit.wikimedia.org/r/336983
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9e25b35d42af3c73c581c6d05a6a4a8dc8ef62c6
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>