jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/508513 )
Change subject: [Bugfix] Fix for compat method url2link and other improvements
......................................................................
[Bugfix] Fix for compat method url2link and other improvements
- url2link(page, site, insite) is a compat function
which wasn't ported to core.
Use Page.title(as_url=True, with_ns=False) instead in makelogpage method
- use join statement instead the for loop to create the WLE list
- read the logbook translation in initializer instead of asking for
ir several times
- set makeWelcomeLog to false if there is no translation for the logbook
- further improvements in makelogpage
detached from Iff53f38
Bug: T222713
Change-Id: I16b63c239c103207409fe540241d4de1a2708eea
---
M scripts/welcome.py
1 file changed, 24 insertions(+), 25 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/welcome.py b/scripts/welcome.py
index df48877..3cf072e 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -487,7 +487,10 @@
self._totallyCount = 0
self.welcomed_users = []
+ self.log_name = i18n.translate(self.site, logbook)
+ if not self.log_name:
+ globalvar.makeWelcomeLog = False
if globalvar.randomSign:
self.defineSign(True)
@@ -667,21 +670,15 @@
def makelogpage(self, queue=None):
"""Make log page."""
- if queue is None:
- queue = []
- if not globalvar.makeWelcomeLog or len(queue) == 0:
- return
+ if not globalvar.makeWelcomeLog or not queue:
+ return False
- text = ''
- logg = i18n.translate(self.site, logbook)
- if not logg:
- return
-
- target = logg + '/' + time.strftime('%Y/%m/%d',
- time.localtime(time.time()))
if self.site.code == 'it':
- target = logg + '/' + time.strftime('%d/%m/%Y',
- time.localtime(time.time()))
+ pattern = '%d/%m/%Y'
+ else:
+ pattern = '%Y/%m/%d'
+ target = self.log_name + '/' + time.strftime(
+ pattern, time.localtime(time.time()))
log_page = pywikibot.Page(self.site, target)
if log_page.exists():
@@ -697,21 +694,25 @@
text += '\n!' + str.capitalize(
self.site.mediawiki_message('contribslink'))
- for result in queue:
- # Adding the log... (don't take care of the variable's name...).
- luser = pywikibot.url2link(result.username, self.site, self.site)
- text += '\n{{WLE|user=%s|contribs=%d}}' % (
- luser, result.editCount())
+ # Adding the log... (don't take care of the variable's name...).
+ text += '\n'
+ text += '\n'.join(
+ '{{WLE|user=%s|contribs=%d}}' % (
+ user.title(as_url=True, with_ns=False), user.editCount())
+ for user in queue)
+
# update log page.
while True:
try:
- log_page.put(text, i18n.twtranslate(
- self.site, 'welcome-updating'))
- return True
+ log_page.put(text, i18n.twtranslate(self.site,
+ 'welcome-updating'))
except pywikibot.EditConflict:
pywikibot.output('An edit conflict has occurred. Pausing for '
'10 seconds before continuing.')
time.sleep(10)
+ else:
+ break
+ return True
def parseNewUserLog(self):
"""Retrieve new users."""
@@ -837,8 +838,7 @@
pywikibot.output('An edit conflict has occurred, '
'skipping this user.')
- if globalvar.makeWelcomeLog and \
- i18n.translate(self.site, logbook):
+ if globalvar.makeWelcomeLog:
showStatus(5)
if welcomed_count == 1:
pywikibot.output('One user has been welcomed.')
@@ -867,8 +867,7 @@
users.editCount()))
# That user mustn't be welcomed.
continue
- if globalvar.makeWelcomeLog and i18n.translate(
- self.site, logbook) and welcomed_count > 0:
+ if globalvar.makeWelcomeLog and welcomed_count > 0:
showStatus()
if welcomed_count == 1:
pywikibot.output('Putting the log of the latest user...')
--
To view, visit https://gerrit.wikimedia.org/r/508513
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I16b63c239c103207409fe540241d4de1a2708eea
Gerrit-Change-Number: 508513
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513031 )
Change subject: [bugfix] Fix _formatLimit_MonthOfYear
......................................................................
[bugfix] Fix _formatLimit_MonthOfYear
Limit is given as 1900 but not recognized by predicate
Change-Id: I72495c1d31774a76880f1e7ebfc60a116ad8cc35
---
M pywikibot/date.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index bf05fc8..a9ffd56 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -2152,7 +2152,7 @@
}
# All month of year articles are in the same format
-_formatLimit_MonthOfYear = (lambda v: 1 <= 1900 and v < 2051, 1900, 2051)
+_formatLimit_MonthOfYear = (lambda v: 1900 <= v < 2051, 1900, 2051)
for month in yrMnthFmts:
formatLimits[month] = _formatLimit_MonthOfYear
--
To view, visit https://gerrit.wikimedia.org/r/513031
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I72495c1d31774a76880f1e7ebfc60a116ad8cc35
Gerrit-Change-Number: 513031
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/501538 )
Change subject: [i18n] Use additional twn messages with checkimages.py
......................................................................
[i18n] Use additional twn messages with checkimages.py
Bug: T220178
Change-Id: I045481ae8aee173cb513f49c1ec08d31c7d1c9d8
---
M scripts/checkimages.py
1 file changed, 25 insertions(+), 128 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 8e0bda5..7411c69 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -201,77 +201,6 @@
'zh': '{{delete|未知檔案格式%s}}',
}
-# The header of the Unknown extension's message.
-delete_immediately_head = {
- 'ar': 'امتداد غير معروف!',
- 'en': 'Unknown extension!',
- 'fa': 'بارگذاری تصاویر موجود در انبار',
- 'ga': 'Iarmhír neamhaithnid!',
- 'fr': 'Extension inconnue',
- 'hu': 'Ismeretlen kiterjesztésű fájl',
- 'it': 'File non specificato',
- 'ko': '잘못된 파일 형식',
- 'sr': 'Непозната екстензија!',
- 'ta': 'இனங்காணப்படாத கோப்பு நீட்சி!',
- 'ur': 'نامعلوم توسیع!',
- 'zh': '您上載的檔案格式可能有誤',
-}
-
-# Text that will be add if the bot find a unknown extension.
-delete_immediately_notification = {
- 'ar': 'الملف %(file)s يبدو أن امتداده خاطيء, من فضلك تحقق.',
- 'en': 'The %(file)s file seems to have a wrong extension, please check.',
- 'fa': 'به نظر میآید تصویر %(file)s'
- 'مسیر نادرستی داشته باشد لطفا بررسی کنید.',
- 'ga': "Tá iarmhír mícheart ar an comhad %(file)s, scrúdaigh le d'thoil.",
- 'fr': 'Le fichier %(file)s semble avoir une mauvaise extension, '
- 'veuillez vérifier.',
- 'hu': 'A %(file)s fájlnak rossz a kiterjesztése, kérlek ellenőrízd.',
- 'it': 'A quanto ci risulta, %(file)s sembra non essere un file utile '
- "all'enciclopedia. Se così non fosse, e' consigliato che tu scriva "
- "al mio programmatore. Grazie per l'attenzione. "
- '<u>Questo è un messaggio automatico di</u>',
- 'ko': '%(file)s의 파일 형식이 잘못되었습니다. 확인 바랍니다.',
- 'sr': 'Изгледа да датотека %(file)s садржи погрешну екстензију.',
- 'ta': '%(file)s இனங்காணப்படாத கோப்பு நீட்சியை கொண்டுள்ளது தயவு '
- 'செய்து ஒரு முறை சரி பார்க்கவும்',
- 'ur': 'ملف %(file)s کی توسیع شاید درست نہیں ہے، براہ کرم جانچ لیں۔',
- 'zh': '您好,你上傳的%(file)s無法被識別,請檢查您的檔案,謝謝。',
-}
-
-# Summary of the delete immediately.
-# (e.g: Adding {{db-meta|The file has .%s as extension.}})
-msg_del_comm = {
- 'ar': 'بوت: إضافة %(adding)s',
- 'en': 'Bot: Adding %(adding)s',
- 'fa': 'ربات: اضافه کردن %(adding)s',
- 'ga': 'Róbó: Cuir %(adding)s leis',
- 'fr': 'Robot : Ajouté %(adding)s',
- 'hr': 'Bot: Dodato %(adding)s',
- 'hu': 'Robot:"%(adding)s" hozzáadása',
- 'it': 'Bot: Aggiungo %(adding)s',
- 'ja': 'ロボットによる: 追加 %(adding)s',
- 'ko': '로봇 : %(adding)s 추가',
- 'sr': 'Бот: Додато %(adding)s',
- 'ta': 'Bot: Adding %(adding)s',
- 'ur': 'روبالہ: اضافہ %(adding)s',
- 'zh': '機器人: 正在新增 %(adding)s',
-}
-
-# This is the most important header, because it will be used a lot. That's the
-# header that the bot will add if the image hasn't the license.
-nothing_head = {
- 'ar': 'صورة بدون ترخيص',
- 'de': 'Bild ohne Lizenz',
- 'en': 'Image without license',
- 'fa': 'تصویر بدون اجازہ',
- 'ga': 'Comhad gan ceadúnas',
- 'fr': 'Fichier sans licence',
- 'hu': 'Licenc nélküli kép',
- 'it': 'File senza licenza',
- 'sr': 'Датотека без лиценце',
- 'ur': 'تصویر بدون اجازہ',
-}
# That's the text that the bot will add if it doesn't find the license.
# Note: every __botnick__ will be repleaced with your bot's nickname
# (feel free not to use if you don't need it)
@@ -360,24 +289,6 @@
'zh': 'User:Alexsh/checkimagereport',
}
-# The summary of the report
-msg_comm10 = {
- 'ar': 'بوت: تحديث السجل',
- 'de': 'Bot: schreibe Log',
- 'en': 'Bot: Updating the log',
- 'fa': 'ربات: بهروزرسانی سیاهه',
- 'fr': 'Robot: Mise à jour du journal',
- 'ga': 'Róbó: Log a thabhairt suas chun dáta',
- 'hu': 'Robot: A napló frissítése',
- 'it': 'Bot: Aggiorno il log',
- 'ja': 'ロボットによる:更新',
- 'ko': '로봇:로그 업데이트',
- 'sr': 'Бот: Ажурирање дневника',
- 'ta': 'தானியங்கி:பட்டியலை இற்றைப்படுத்தல்',
- 'ur': 'روبالہ: تجدید نوشتہ',
- 'zh': '機器人:更新記錄',
-}
-
# If a template isn't a license but it's included on a lot of images, that can
# be skipped to analyze the image without taking care of it. (the template must
# be in a list)
@@ -456,39 +367,12 @@
'sr': '{{NowCommons|__image__}}',
}
-# Head of the message given to the author
-duplicate_user_talk_head = {
- 'de': 'Datei-Duplikat',
- 'en': 'Duplicate file',
- 'it': 'File doppio',
- 'sr': 'Дупликат датотеке',
-}
-
# Message to put in the talk
duplicates_user_talk_text = {
'it': '{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Duplicati|'
'%s|%s|~~~}} --~~~~',
}
-# Comment used by the bot while it reports the problem in the uploader's talk
-duplicates_comment_talk = {
- 'ar': 'بوت: ملف مكرر تم العثور عليه',
- 'en': 'Bot: Notify that the file already exists on Commons',
- 'fa': 'ربات: تصویر تکراری یافت شد',
- 'it': 'Bot: Notifico il file doppio trovato',
- 'sr': 'Бот: Обавештење да датотека већ постоји на Остави',
-}
-
-# Comment used by the bot while it reports the problem in the image
-duplicates_comment_image = {
- 'ar': 'بوت: وسم ملف مكرر',
- 'de': 'Bot: Datei liegt auf Commons',
- 'en': 'Bot: File already on Commons, may be deleted',
- 'fa': 'ربات: برچسب زدن بر تصویر تکراری',
- 'it': 'Bot: File doppio, da cancellare',
- 'sr': 'Бот: Датотека већ постоји на Остави',
-}
-
# Regex to detect the template put in the image's description to find the dupe
duplicatesRegex = {
'commons': r'\{\{(?:[Tt]emplate:|)(?:[Dd]up(?:licat|)e|[Bb]ad[ _][Nn]ame)'
@@ -587,7 +471,10 @@
self.rep_page = i18n.translate(self.site, report_page)
self.image_namespace = site.namespaces.FILE.custom_name + ':'
self.list_entry = '\n* [[:{0}%s]] '.format(self.image_namespace)
- self.com = i18n.translate(self.site, msg_comm10, fallback=True)
+
+ # The summary of the report
+ self.com = i18n.twtranslate(self.site, 'checkimages-log-comment')
+
hiddentemplatesRaw = i18n.translate(self.site, HiddenTemplate)
self.hiddentemplates = {
pywikibot.Page(self.site, tmp, ns=self.site.namespaces.TEMPLATE)
@@ -910,13 +797,17 @@
"""Function to check the duplicated files."""
dupText = i18n.translate(self.site, duplicatesText)
dupRegex = i18n.translate(self.site, duplicatesRegex)
- dupTalkHead = i18n.translate(self.site, duplicate_user_talk_head,
- fallback=True)
dupTalkText = i18n.translate(self.site, duplicates_user_talk_text)
- dupComment_talk = i18n.translate(self.site, duplicates_comment_talk,
- fallback=True)
- dupComment_image = i18n.translate(self.site, duplicates_comment_image,
- fallback=True)
+
+ # Head of the message given to the author
+ dupTalkHead = i18n.twtranslate(self.site, 'checkimages-doubles-head')
+ # Comment while bot reports the problem in the uploader's talk
+ dupComment_talk = i18n.twtranslate(self.site,
+ 'checkimages-doubles-talk-comment')
+ # Comment used by the bot while it reports the problem in the image
+ dupComment_image = i18n.twtranslate(self.site,
+ 'checkimages-doubles-file-comment')
+
imagePage = pywikibot.FilePage(self.site, self.imageName)
hash_found = imagePage.latest_file_info.sha1
duplicates = list(self.site.allimages(sha1=hash_found))
@@ -1501,12 +1392,18 @@
HiddenTN = i18n.translate(self.site, HiddenTemplateNotification)
self.unvertext = i18n.translate(self.site, n_txt)
di = i18n.translate(self.site, delete_immediately)
- dih = i18n.translate(self.site, delete_immediately_head, fallback=True)
- din = i18n.translate(self.site, delete_immediately_notification,
- fallback=True) + ' ~~~~'
- nh = i18n.translate(self.site, nothing_head, fallback=True)
+
+ # The header of the Unknown extension's message.
+ dih = i18n.twtranslate(self.site, 'checkimages-unknown-extension-head')
+ # Text that will be add if the bot find a unknown extension.
+ din = i18n.twtranslate(self.site,
+ 'checkimages-unknown-extension-msg') + ' ~~~~'
+ # Header that the bot will add if the image hasn't the license.
+ nh = i18n.twtranslate(self.site, 'checkimages-no-license-head')
+ # Summary of the delete immediately.
+ dels = i18n.twtranslate(self.site, 'checkimages-deletion-comment')
+
nn = i18n.translate(self.site, nothing_notification)
- dels = i18n.translate(self.site, msg_del_comm, fallback=True)
smwl = i18n.translate(self.site, second_message_without_license)
try:
--
To view, visit https://gerrit.wikimedia.org/r/501538
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I045481ae8aee173cb513f49c1ec08d31c7d1c9d8
Gerrit-Change-Number: 501538
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: jenkins-bot (75)