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 <>