jenkins-bot has submitted this change and it was merged.
Change subject: Fix isbn.py -to13 operation when ISBN are already in this format
......................................................................
Fix isbn.py -to13 operation when ISBN are already in this format
Currently, the isbn.py -to13 operation doesn't support objects
already in ISBN 13 format.
To fix this issue, a toISBN13 method is added to the ISBN13 class.
Ideally this wouldn't be required but this allows to simplify code.
Bug: T138911
Change-Id: I755c8623486ed29a273891e17025b4b468273005
---
M scripts/isbn.py
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Eranroz: Looks good to me, but someone else must approve
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/isbn.py b/scripts/isbn.py
index b96676c..7e83f9d 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1466,7 +1466,11 @@
except InvalidIsbnException:
# don't change
return isbn
- i13 = getIsbn(isbn).toISBN13()
+ i1x = getIsbn(isbn)
+ if not isinstance(i1x, ISBN13):
+ i13 = i1x.toISBN13()
+ else:
+ i13 = i1x
return i13.code
--
To view, visit https://gerrit.wikimedia.org/r/312726
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I755c8623486ed29a273891e17025b4b468273005
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Aadith1996 <96aadith(a)gmail.com>
Gerrit-Reviewer: Aadith1996 <96aadith(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Eranroz <eranroz89(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] Simplify arg parsing
......................................................................
[IMPR] Simplify arg parsing
Change-Id: If4d9038781d2e702d78bebf11b16c4a8460b250a
---
M scripts/welcome.py
1 file changed, 30 insertions(+), 47 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 0f2f908..ed0dd34 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -893,30 +893,24 @@
@type args: list of unicode
"""
for arg in pywikibot.handle_args(args):
- if arg.startswith('-edit'):
- if len(arg) == 5:
- globalvar.attachEditCount = int(pywikibot.input(
- u'After how many edits would you like to welcome new users? (0 is allowed)'))
- else:
- globalvar.attachEditCount = int(arg[6:])
- elif arg.startswith('-timeoffset'):
- if len(arg) == 11:
- globalvar.timeoffset = int(pywikibot.input(
- 'Which time offset (in minutes) for new users would you like to use?'))
- else:
- globalvar.timeoffset = int(arg[12:])
- elif arg.startswith('-time'):
- if len(arg) == 5:
- globalvar.timeRecur = int(pywikibot.input(
- u'For how many seconds would you like to bot to sleep before checking again?'))
- else:
- globalvar.timeRecur = int(arg[6:])
- elif arg.startswith('-offset'):
- if len(arg) == 7:
+ arg, sep, val = arg.partition(':')
+ if arg == '-edit':
+ globalvar.attachEditCount = int(val or pywikibot.input(
+ 'After how many edits would you like to welcome new users? '
+ '(0 is allowed)'))
+ elif arg == '-timeoffset':
+ globalvar.timeoffset = int(val or pywikibot.input(
+ 'Which time offset (in minutes) for new users would you like '
+ 'to use?'))
+ elif arg == '-time':
+ globalvar.timeRecur = int(val or pywikibot.input(
+ 'For how many seconds would you like to bot to sleep before '
+ 'checking again?'))
+ elif arg == '-offset':
+ if not val:
val = pywikibot.input(
- 'Which time offset for new users would you like to use? (yyyymmddhhmmss)')
- else:
- val = arg[8:]
+ 'Which time offset for new users would you like to use? '
+ '(yyyymmddhhmmss)')
try:
globalvar.offset = pywikibot.Timestamp.fromtimestampformat(val)
except ValueError:
@@ -926,19 +920,13 @@
"anymore, but -offset:TIMESTAMP is, assuming TIMESTAMP "
"is yyyymmddhhmmss. -timeoffset is now also supported. "
"Please read this script source header for documentation.")
- elif arg.startswith('-file'):
+ elif arg == '-file':
globalvar.randomSign = True
- if len(arg) <= 6:
- globalvar.signFileName = pywikibot.input(
- u'Where have you saved your signatures?')
- else:
- globalvar.signFileName = arg[6:]
- elif arg.startswith('-sign'):
- if len(arg) <= 6:
- globalvar.defaultSign = pywikibot.input(
- u'Which signature to use?')
- else:
- globalvar.defaultSign = arg[6:]
+ globalvar.signFileName = val or pywikibot.input(
+ 'Where have you saved your signatures?')
+ elif arg == '-sign':
+ globalvar.defaultSign = val or pywikibot.input(
+ 'Which signature to use?')
globalvar.defaultSign += timeselected
elif arg == '-break':
globalvar.recursive = False
@@ -954,18 +942,13 @@
globalvar.randomSign = True
elif arg == '-sul':
globalvar.welcomeAuto = True
- elif arg.startswith('-limit'):
- if len(arg) == 6:
- globalvar.queryLimit = int(pywikibot.input(
- u'How many of the latest new users would you like to load?'))
- else:
- globalvar.queryLimit = int(arg[7:])
- elif arg.startswith('-numberlog'):
- if len(arg) == 10:
- globalvar.dumpToLog = int(pywikibot.input(
- u'After how many welcomed users would you like to update the welcome log?'))
- else:
- globalvar.dumpToLog = int(arg[11:])
+ elif arg == '-limit':
+ globalvar.queryLimit = int(val or pywikibot.input(
+ u'How many of the latest new users would you like to load?'))
+ elif arg == '-numberlog':
+ globalvar.dumpToLog = int(val or pywikibot.input(
+ 'After how many welcomed users would you like to update the '
+ 'welcome log?'))
elif arg == '-quiet':
globalvar.quiet = True
elif arg == '-quick':
--
To view, visit https://gerrit.wikimedia.org/r/312202
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If4d9038781d2e702d78bebf11b16c4a8460b250a
Gerrit-PatchSet: 4
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.
Change subject: [bugfix] reset the page.text content
......................................................................
[bugfix] reset the page.text content
- content retrieved from generator is saved in the page content
yielded to the treat_page method. This content must be saved to
a local variable and the page.text must be reseted to be updated
from live wiki page.
Bug: T147766
Change-Id: I68fe4d61329b8827f3029d0ec7e184aa1a67446b
---
M scripts/pagefromfile.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 23e5743..390f26f 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -130,7 +130,10 @@
"""Upload page content."""
page = self.current_page
title = page.title()
+ # save the content retrieved from generator
contents = page.text
+ # delete page's text to get it from live wiki
+ del page.text
if self.getOption('summary'):
comment = self.getOption('summary')
@@ -148,7 +151,7 @@
if not self.getOption('redirect') and page.isRedirectPage():
pywikibot.output(u"Page %s is redirect, skipping!" % title)
return
- pagecontents = page.get(get_redirect=True)
+ pagecontents = page.text
nocontent = self.getOption('nocontent')
if nocontent and (
nocontent in pagecontents or
--
To view, visit https://gerrit.wikimedia.org/r/315095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I68fe4d61329b8827f3029d0ec7e184aa1a67446b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [L10N] Use informationTemplate in imagecopy_self.py and other improvements
......................................................................
[L10N] Use informationTemplate in imagecopy_self.py and other improvements
- store dictionary parts outside the loop
- supportedSite() completed for two additional L10N dicts
- direct access instead of get() because it is sure the key exists
(on the other hand it was never tested before)
- L10N completed for lb-wiki
- Also keep lines beneath 80 chars
Bug: T148769
Change-Id: I5bd048d31dc443ba0100f06f1006d6f5c2425e94
---
M scripts/imagecopy_self.py
1 file changed, 22 insertions(+), 8 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index 93599b9..3b4eb1d 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -85,10 +85,11 @@
nowCommonsTemplate = {
'de': u'{{NowCommons|%s}}',
- 'en': u'{{NowCommons|1=File:%s|date=~~~~~|reviewer={{subst:REVISIONUSER}}}}',
+ 'en': '{{NowCommons|1=File:%s|date=~~~~~|reviewer={{subst:REVISIONUSER}}}}',
'lb': u'{{Elo op Commons|%s}}',
'nds-nl': u'{{NoenCommons|1=File:%s}}',
- 'shared': u'{{NowCommons|1=File:%s|date=~~~~~|reviewer={{subst:REVISIONUSER}}}}',
+ 'shared': ('{{NowCommons|1=File:%s|date=~~~~~|'
+ 'reviewer={{subst:REVISIONUSER}}}}'),
}
moveToCommonsTemplate = {
@@ -262,6 +263,7 @@
informationTemplate = {
'de': 'Information',
'en': 'Information',
+ 'lb': 'Information',
'nds-nl': 'Information',
'shared': 'Information',
}
@@ -277,6 +279,15 @@
u'andere Versione': u'other versions',
},
'en': {
+ u'location': u'remarks',
+ u'description': u'description',
+ u'source': u'source',
+ u'date': u'date',
+ u'author': u'author',
+ u'permission': u'permission',
+ u'other versions': u'other versions',
+ },
+ 'lb': {
u'location': u'remarks',
u'description': u'description',
u'source': u'source',
@@ -316,6 +327,8 @@
skipTemplates,
licenseTemplates,
sourceGarbage,
+ informationTemplate,
+ informationFields,
]
for l in lists:
if not l.get(lang):
@@ -422,24 +435,25 @@
other_versions = u''
contents = {}
- for key, value in informationFields.get(imagepage.site.lang).items():
+ for key, value in informationFields[imagepage.site.lang].items():
contents[value] = u''
templates = imagepage.templatesWithParams()
+ information = informationTemplate[imagepage.site.lang]
+ fields = informationFields[imagepage.site.lang]
for (template, params) in templates:
- if template == u'Information':
+ if template == information:
for param in params:
# Split at =
(field, sep, value) = param.partition(u'=')
# To lowercase, remove underscores and strip of spaces
field = field.lower().replace(u'_', u' ').strip()
+ key = fields.get(field)
# See if first part is in fields list
- if field in informationFields.get(
- imagepage.site.lang).keys():
+ if key:
# Ok, field is good, store it.
- contents[informationFields.get(
- imagepage.site.lang).get(field)] = value.strip()
+ contents[key] = value.strip()
# We now got the contents from the old information template.
# Let's get the info for the new one
--
To view, visit https://gerrit.wikimedia.org/r/316312
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5bd048d31dc443ba0100f06f1006d6f5c2425e94
Gerrit-PatchSet: 3
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: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>