jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] Request: Recover from bad tokens
......................................................................
[FEAT] Request: Recover from bad tokens
When a badtoken error happens it checks all parameters if one of them is
using a cached token value and then buffers the type for that the token
value is used. It then rerequests all tokens for the buffered types and
is then changing those parameters to have the new value.
Bug: T61678
Change-Id: I0c2f7b3e8726e26c68651bd5714f6f42d1f3bedf
---
M pywikibot/data/api.py
M tests/api_tests.py
2 files changed, 51 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index b57a61d..a9d30a6 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1688,6 +1688,39 @@
if code == 'readapidenied' and self.site._loginstatus in (-3, -1):
self.site.login()
continue
+ if code == 'badtoken':
+ user_tokens = self.site.tokens._tokens[self.site.user()]
+ # all token values mapped to their type
+ tokens = dict((token, t_type)
+ for t_type, token in user_tokens.items())
+ # determine which tokens are bad
+ invalid_param = {}
+ for name, param in self._params.items():
+ if len(param) == 1 and param[0] in tokens:
+ invalid_param[name] = tokens[param[0]]
+ # doesn't care about the cache so can directly load them
+ if invalid_param:
+ pywikibot.log(
+ u'Bad token error for {0}. Tokens for "{1}" used in '
+ u'request; invalidated them.'.format(
+ self.site.user(),
+ '", "'.join(sorted(set(invalid_param.values())))))
+ self.site.tokens.load_tokens(set(invalid_param.values()))
+ # fix parameters; lets hope that it doesn't mistake actual
+ # parameters as tokens
+ for name, t_type in invalid_param.items():
+ self[name] = self.site.tokens[t_type]
+ continue
+ else:
+ # otherwise couldn't find any … weird there is nothing what
+ # can be done here because it doesn't know which parameters
+ # to fix
+ pywikibot.log(
+ u'Bad token error for {0} but no parameter is using a '
+ u'token. Current tokens: {1}'.format(
+ self.site.user(),
+ ', '.join('{0}: {1}'.format(*e)
+ for e in user_tokens.items())))
# raise error
try:
pywikibot.log(u"API Error: query=\n%s"
diff --git a/tests/api_tests.py b/tests/api_tests.py
index d827f9c..897340e 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -683,6 +683,24 @@
self.assertRaises(pywikibot.NoUsername, req.submit)
+class TestBadTokenRecovery(TestCase):
+
+ """Test that the request recovers from bad tokens."""
+
+ family = 'wikipedia'
+ code = 'test'
+
+ write = True
+
+ def test_bad_token(self):
+ site = self.get_site()
+ site.tokens._tokens.setdefault(site.user(), {})['edit'] = 'INVALID'
+ page = pywikibot.Page(site, 'Pywikibot bad token test')
+ page.text = ('This page is testing whether pywikibot-core rerequests '
+ 'a token when a badtoken error was received.')
+ page.save(comment='Bad token test')
+
+
if __name__ == '__main__':
try:
unittest.main()
--
To view, visit https://gerrit.wikimedia.org/r/201967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0c2f7b3e8726e26c68651bd5714f6f42d1f3bedf
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Porting piper.py from pywikibot-compat to core.
......................................................................
Porting piper.py from pywikibot-compat to core.
Change-Id: I7578faa86371ee60faaa2a71ec7d11c37c847885
---
A scripts/piper.py
1 file changed, 150 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/piper.py b/scripts/piper.py
new file mode 100644
index 0000000..b12f21f
--- /dev/null
+++ b/scripts/piper.py
@@ -0,0 +1,150 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+This bot uses external filtering programs for munging text.
+
+For example:
+
+ python pwb.py piper.py -filter:'tr A-Z a-z' -page:Wikipedia:Sandbox
+
+Would lower case the article with tr(1).
+
+Muliple -filter commands can be specified:
+
+ python pwb.py piper.py -filter:cat -filter:'tr A-Z a-z' -filter:'tr a-z A-Z' -page:Wikipedia:Sandbox
+
+
+Would pipe the article text through cat(1) (NOOP) and then lower case
+it with tr(1) and upper case it again with tr(1)
+
+The following parameters are supported:
+
+¶ms;
+
+ -always Always commit changes without asking you to accept them
+
+ -filter: Filter the article text through this program, can be
+ given multiple times to filter through multiple programs in
+ the order which they are given
+
+"""
+#
+# (C) Pywikibot team, 2008-2015
+#
+# Distributed under the terms of the MIT license.
+#
+__version__ = '$Id$'
+#
+
+import os
+import pipes
+import tempfile
+
+import pywikibot
+
+from pywikibot import i18n, pagegenerators
+from pywikibot.bot import ExistingPageBot, NoRedirectPageBot
+
+# This is required for the text that is shown when you run this script
+# with the parameter -help.
+docuReplacements = {
+ '¶ms;': pagegenerators.parameterHelp
+}
+
+
+class PiperBot(ExistingPageBot, NoRedirectPageBot):
+
+ """Bot for munging text using external filtering programs."""
+
+ def __init__(self, generator, **kwargs):
+ """
+ Constructor.
+
+ @param generator: The page generator that determines on which pages
+ to work on.
+ """
+ self.availableOptions.update({
+ 'always': False,
+ 'filters': [],
+ 'comment': None,
+ })
+ super(PiperBot, self).__init__(generator=generator, **kwargs)
+
+ def pipe(self, program, text):
+ """Pipe a given text through a given program.
+
+ @return: processed text after piping
+ @rtype: unicode
+ """
+ text = text.encode('utf-8')
+ pipe = pipes.Template()
+ pipe.append(program.encode('ascii'), '--')
+
+ # Create a temporary filename to save the piped stuff to
+ tempFilename = '%s.%s' % (tempfile.mktemp(), 'txt')
+ with pipe.open(tempFilename, 'w') as file:
+ file.write(text)
+
+ # Now retrieve the munged text
+ with open(tempFilename, 'r') as mungedText:
+ unicode_text = mungedText.read().decode('utf-8')
+
+ # clean up
+ os.unlink(tempFilename)
+ return unicode_text
+
+ def treat_page(self):
+ """Load the given page, does some changes, and saves it."""
+ # Load the page
+ text = self.current_page.text
+
+ # Munge!
+ for program in self.getOption('filters'):
+ text = self.pipe(program, text)
+
+ # only save if something was changed
+ self.put_current(text, comment=self.getOption('comment'))
+
+
+def main(*args):
+ # This factory is responsible for processing command line arguments
+ # that are also used by other scripts and that determine on which pages
+ # to work on.
+ genFactory = pagegenerators.GeneratorFactory()
+ # The generator gives the pages that should be worked upon.
+ gen = None
+ # The program to pipe stuff through
+ filters = []
+ options = {}
+
+ # Parse command line arguments
+ for arg in pywikibot.handle_args(args):
+ if arg.startswith("-filter:"):
+ prog = arg[8:]
+ filters.append(prog)
+ elif arg.startswith("-always"):
+ options['always'] = True
+ else:
+ # check if a standard argument like
+ # -start:XYZ or -ref:Asdf was given.
+ genFactory.handleArg(arg)
+
+ options['filters'] = filters
+ s = ', '.join(options['filters'])
+ options['comment'] = i18n.twtranslate(pywikibot.Site().lang,
+ 'piper-edit-summary') % s
+
+ if not gen:
+ gen = genFactory.getCombinedGenerator()
+ if gen:
+ # The preloading generator is responsible for downloading multiple
+ # pages from the wiki simultaneously.
+ gen = pagegenerators.PreloadingGenerator(gen)
+ bot = PiperBot(gen, **options)
+ bot.run()
+ else:
+ pywikibot.showHelp()
+
+
+if __name__ == '__main__':
+ main()
--
To view, visit https://gerrit.wikimedia.org/r/194825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7578faa86371ee60faaa2a71ec7d11c37c847885
Gerrit-PatchSet: 14
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Prianka <priyankajayaswal025(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Prianka <priyankajayaswal025(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] Copy messages from fixes
......................................................................
[FEAT] Copy messages from fixes
Change-Id: Ie29ba314a571b00f508e1cc95bc792dbef50af00
---
M pywikibot/ar.json
M pywikibot/be-x-old.json
A pywikibot/be.json
M pywikibot/cs.json
M pywikibot/de.json
M pywikibot/en.json
M pywikibot/eo.json
M pywikibot/fa.json
M pywikibot/fr.json
M pywikibot/he.json
M pywikibot/ia.json
M pywikibot/ja.json
M pywikibot/ksh.json
M pywikibot/lt.json
M pywikibot/nl.json
M pywikibot/pl.json
M pywikibot/pt.json
M pywikibot/qqq.json
M pywikibot/ru.json
M pywikibot/sr.json
M pywikibot/sv.json
M pywikibot/uk.json
M pywikibot/zh.json
23 files changed, 114 insertions(+), 33 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
XZise: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/ar.json b/pywikibot/ar.json
index 877ccfd..0c6ecc6 100644
--- a/pywikibot/ar.json
+++ b/pywikibot/ar.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Meno25",
"TTMTT"
]
},
@@ -10,5 +11,7 @@
"pywikibot-enter-namespace-number": "الرجاء إدخال مساحة اسم برقمه:",
"pywikibot-enter-new-text": "فضلاً ادخل النص الجديد:",
"pywikibot-enter-category-name": "فضلاً ادخل إسم التصنيف:",
- "pywikibot-enter-finished-browser": "اضغط Enter عند الانتهاء في المستعرض."
-}
+ "pywikibot-enter-finished-browser": "اضغط Enter عند الانتهاء في المستعرض.",
+ "pywikibot-fixes-html": "روبوت: تحويل/تصليح HTML",
+ "pywikibot-fixes-syntax": "بوت: تصليح تهيئة الويكي"
+}
\ No newline at end of file
diff --git a/pywikibot/be-x-old.json b/pywikibot/be-x-old.json
index f6967b1..d8dba7c 100644
--- a/pywikibot/be-x-old.json
+++ b/pywikibot/be-x-old.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Dmitry Nikitin",
"Red Winged Duck",
"Renessaince"
]
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Калі ласка, увядзіце нумар прасторы імёнаў:",
"pywikibot-enter-new-text": "Калі ласка, увядзіце новы тэкст:",
"pywikibot-enter-category-name": "Калі ласка, увядзіце назву катэгорыі:",
- "pywikibot-enter-finished-browser": "Націсьніце Enter, калі скончыце рэдагаваньне ў броўзэры."
+ "pywikibot-enter-finished-browser": "Націсьніце Enter, калі скончыце рэдагаваньне ў броўзэры.",
+ "pywikibot-fixes-html": "Бот: карэкцыя HTML",
+ "pywikibot-fixes-syntax": "Бот выпраўляе вiкi-сынтаксiс"
}
diff --git a/pywikibot/be.json b/pywikibot/be.json
new file mode 100644
index 0000000..6a762b2
--- /dev/null
+++ b/pywikibot/be.json
@@ -0,0 +1,9 @@
+{
+ "@metadata": {
+ "authors": [
+ "Francesco Cosoleto"
+ ]
+ },
+ "pywikibot-fixes-html": "Бот: карэкцыя HTML",
+ "pywikibot-fixes-syntax": "Бот: Карэкцыя вiкi-сiнтаксiсу"
+}
\ No newline at end of file
diff --git a/pywikibot/cs.json b/pywikibot/cs.json
index 4c59000..90b24de 100644
--- a/pywikibot/cs.json
+++ b/pywikibot/cs.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "JAn Dudík",
"Leanes",
"Matěj Suchánek",
"Tchoř"
@@ -12,5 +13,7 @@
"pywikibot-enter-namespace-number": "Prosím, zadejte číslo jmenného prostoru:",
"pywikibot-enter-new-text": "Prosím zadejte nový text:",
"pywikibot-enter-category-name": "Prosím, zadejte jméno kategorie:",
- "pywikibot-enter-finished-browser": "Po ukončení práce v prohlížeči zmáčněte Enter."
+ "pywikibot-enter-finished-browser": "Po ukončení práce v prohlížeči zmáčněte Enter.",
+ "pywikibot-fixes-html": "převod/oprava HTML",
+ "pywikibot-fixes-syntax": "Oprava wikisyntaxe"
}
diff --git a/pywikibot/de.json b/pywikibot/de.json
index 93ce25d..f4d5185 100644
--- a/pywikibot/de.json
+++ b/pywikibot/de.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Daniel Herding",
"Se4598",
"Xqt"
]
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Bitte gib die Nummer des Namensraums ein:",
"pywikibot-enter-new-text": "Bitte gib den neuen Text ein:",
"pywikibot-enter-category-name": "Bitte Name der Kategorie eingeben:",
- "pywikibot-enter-finished-browser": "Enter drücken nach dem Beenden des Browsers."
-}
+ "pywikibot-enter-finished-browser": "Enter drücken nach dem Beenden des Browsers.",
+ "pywikibot-fixes-html": "Bot: konvertiere/korrigiere HTML",
+ "pywikibot-fixes-syntax": "Bot: Korrigiere Wiki-Syntax"
+}
\ No newline at end of file
diff --git a/pywikibot/en.json b/pywikibot/en.json
index 607fb5e..780d233 100644
--- a/pywikibot/en.json
+++ b/pywikibot/en.json
@@ -1,10 +1,19 @@
{
- "@metadata": [],
+ "@metadata": {
+ "authors": [
+ "Daniel Herding",
+ "Huji",
+ "Siebrand"
+ ]
+ },
"pywikibot-enter-xml-filename": "Please enter the XML dump's filename:",
"pywikibot-enter-page-processing": "Which page should be processed?",
"pywikibot-enter-file-links-processing": "Links to which file page should be processed?",
"pywikibot-enter-namespace-number": "Please enter a namespace by its number:",
"pywikibot-enter-new-text": "Please enter the new text:",
"pywikibot-enter-category-name": "Please enter the category name:",
- "pywikibot-enter-finished-browser": "Press Enter when finished in browser."
+ "pywikibot-enter-finished-browser": "Press Enter when finished in browser.",
+ "pywikibot-fixes-html": "Robot: Converting/fixing HTML",
+ "pywikibot-fixes-syntax": "Robot: Fixing wiki syntax",
+ "pywikibot-fixes-fckeditor": "Robot: Fixing rich-editor html"
}
diff --git a/pywikibot/eo.json b/pywikibot/eo.json
index 58af720..0546ff6 100644
--- a/pywikibot/eo.json
+++ b/pywikibot/eo.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"Blahma",
+ "Dmitry Nikitin",
"KuboF",
"Objectivesea"
]
@@ -12,5 +13,7 @@
"pywikibot-enter-namespace-number": "Bonvolu enmeti nomspacon per ties numero:",
"pywikibot-enter-new-text": "Bonvolu enmeti la novan tekston:",
"pywikibot-enter-category-name": "Bonvolu enmeti la nomon de kategorio:",
- "pywikibot-enter-finished-browser": "Post laborfino en la retumilo, premu Enter."
+ "pywikibot-enter-finished-browser": "Post laborfino en la retumilo, premu Enter.",
+ "pywikibot-fixes-html": "Bot: koredtado de HTMLa teksto",
+ "pywikibot-fixes-syntax": "Bot: Korektado de vikia sintakso"
}
diff --git a/pywikibot/fa.json b/pywikibot/fa.json
index 98b5b3b..8d7d207 100644
--- a/pywikibot/fa.json
+++ b/pywikibot/fa.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Amir Sarabadani",
"Huji",
"Ladsgroup",
"Reza1615",
@@ -13,5 +14,8 @@
"pywikibot-enter-namespace-number": "لطفاً شمارهٔ یک فضای نام را وارد کنید:",
"pywikibot-enter-new-text": "لطفاً متن جدید را وارد کنید:",
"pywikibot-enter-category-name": "لطفاً نام رده را وارد کنید:",
- "pywikibot-enter-finished-browser": "هنگامی که در مرورگر پایان یافت دکمهٔ اینتر را بفشارید."
-}
+ "pywikibot-enter-finished-browser": "هنگامی که در مرورگر پایان یافت دکمهٔ اینتر را بفشارید.",
+ "pywikibot-fixes-html": "ربات:تبدیل/تصحیح کدهای اچتیامال",
+ "pywikibot-fixes-syntax": "ربات:تصحیح قالب ویکینویسی",
+ "pywikibot-fixes-fckeditor": "ربات: تصحیح اچتیامال ویرایشگر پیشرفته"
+}
\ No newline at end of file
diff --git a/pywikibot/fr.json b/pywikibot/fr.json
index 2122976..b1ab883 100644
--- a/pywikibot/fr.json
+++ b/pywikibot/fr.json
@@ -2,7 +2,8 @@
"@metadata": {
"authors": [
"Gomoko",
- "Romainhk"
+ "Romainhk",
+ "Tavernier"
]
},
"pywikibot-enter-xml-filename": "Veuillez entrer le nom du fichier d'extraction XML:",
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Veuillez entrer un espace de noms grâce à son numéro:",
"pywikibot-enter-new-text": "Veuillez entrer le nouveau texte:",
"pywikibot-enter-category-name": "Veuillez entrer le nom de la catégorie:",
- "pywikibot-enter-finished-browser": "Appuyez sur Entrée une fois que vous avez fini dans le navigateur."
+ "pywikibot-enter-finished-browser": "Appuyez sur Entrée une fois que vous avez fini dans le navigateur.",
+ "pywikibot-fixes-html": "Robot: convertit/fixe HTML",
+ "pywikibot-fixes-syntax": "Bot: Corrige wiki-syntaxe"
}
diff --git a/pywikibot/he.json b/pywikibot/he.json
index 0959d72..460a282 100644
--- a/pywikibot/he.json
+++ b/pywikibot/he.json
@@ -1,7 +1,8 @@
{
"@metadata": {
"authors": [
- "Amire80"
+ "Amire80",
+ "Leonardo Gregianin"
]
},
"pywikibot-enter-xml-filename": "נא להזין את שם קובץ ה־XML עם הדאמפ:",
@@ -10,5 +11,7 @@
"pywikibot-enter-namespace-number": "נא להזין את שם מרחב השם לפי המספר שלו:",
"pywikibot-enter-new-text": "נא להזין את הטקסט החדש:",
"pywikibot-enter-category-name": "נא להזין את שם הקטגוריה:",
- "pywikibot-enter-finished-browser": "יש ללחוץ Enter כאשר מסתיימת הפעולה בדפדפן."
-}
+ "pywikibot-enter-finished-browser": "יש ללחוץ Enter כאשר מסתיימת הפעולה בדפדפן.",
+ "pywikibot-fixes-html": "בוט: ממיר/מתקן HTML",
+ "pywikibot-fixes-syntax": "בוט: מתקן תחביר ויקי"
+}
\ No newline at end of file
diff --git a/pywikibot/ia.json b/pywikibot/ia.json
index 1408d79..ef48404 100644
--- a/pywikibot/ia.json
+++ b/pywikibot/ia.json
@@ -10,5 +10,7 @@
"pywikibot-enter-namespace-number": "Per favor entra le numero de un spatio de nomines:",
"pywikibot-enter-new-text": "Per favor entra le nove texto:",
"pywikibot-enter-category-name": "Per favor entra le nomine del categoria:",
- "pywikibot-enter-finished-browser": "Preme Enter quando tu ha finite le modification in le navigator."
+ "pywikibot-enter-finished-browser": "Preme Enter quando tu ha finite le modification in le navigator.",
+ "pywikibot-fixes-html": "Robot: conversion/reparation de HTML",
+ "pywikibot-fixes-syntax": "Robot: Reparation de syntaxe wiki"
}
diff --git a/pywikibot/ja.json b/pywikibot/ja.json
index 5d0323b..ff7e2f7 100644
--- a/pywikibot/ja.json
+++ b/pywikibot/ja.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Alex Shih-Han Lin",
"Shirayuki"
]
},
@@ -10,5 +11,7 @@
"pywikibot-enter-namespace-number": "名前空間の番号を入力:",
"pywikibot-enter-new-text": "新しいテキストを入力:",
"pywikibot-enter-category-name": "カテゴリ名を入力:",
- "pywikibot-enter-finished-browser": "終了したら Enter キーを押してください。"
+ "pywikibot-enter-finished-browser": "終了したら Enter キーを押してください。",
+ "pywikibot-fixes-html": "ロボットによる: HTML転換",
+ "pywikibot-fixes-syntax": "ロボットによる: wiki構文修正"
}
diff --git a/pywikibot/ksh.json b/pywikibot/ksh.json
index 5c6a3ca..3abc145 100644
--- a/pywikibot/ksh.json
+++ b/pywikibot/ksh.json
@@ -10,5 +10,6 @@
"pywikibot-enter-namespace-number": "Jif de Nommer för dat Apachtemang en:",
"pywikibot-enter-new-text": "Jif dä neue Täx en:",
"pywikibot-enter-category-name": "Jif dä Saachjropp iere Naame en:",
- "pywikibot-enter-finished-browser": "Dröck de <i lang=\"en\">Enter</i>-Taßß, wann de fäädesch beß em Brauser."
+ "pywikibot-enter-finished-browser": "Dröck de <i lang=\"en\">Enter</i>-Taßß, wann de fäädesch beß em Brauser.",
+ "pywikibot-fixes-html": "Bot: vun HTML en Wikikood wandelle"
}
diff --git a/pywikibot/lt.json b/pywikibot/lt.json
index efd471d..d1b989f 100644
--- a/pywikibot/lt.json
+++ b/pywikibot/lt.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Aurimas Fischer",
"Hugo.arg",
"Mantak111"
]
@@ -10,5 +11,7 @@
"pywikibot-enter-namespace-number": "Įvestkite vardų srities numerį:",
"pywikibot-enter-new-text": "Įveskite naują tekstą:",
"pywikibot-enter-category-name": "Įveskite kategorijos pavadinimą:",
- "pywikibot-enter-finished-browser": "Paspauskite Enter kuomet baigsite naršyklėje."
+ "pywikibot-enter-finished-browser": "Paspauskite Enter kuomet baigsite naršyklėje.",
+ "pywikibot-fixes-html": "robotas: konvertuojamas/taisomas HTML",
+ "pywikibot-fixes-syntax": "robotas: Taisoma wiki sintaksė"
}
diff --git a/pywikibot/nl.json b/pywikibot/nl.json
index c5a7330..9726184 100644
--- a/pywikibot/nl.json
+++ b/pywikibot/nl.json
@@ -10,5 +10,7 @@
"pywikibot-enter-namespace-number": "Geef een naamruimtenummer op:",
"pywikibot-enter-new-text": "Geef de nieuwe tekst op:",
"pywikibot-enter-category-name": "Geef de categorienaam op:",
- "pywikibot-enter-finished-browser": "Druk op \"Enter\" wanneer u klaar bent in de browser."
+ "pywikibot-enter-finished-browser": "Druk op \"Enter\" wanneer u klaar bent in de browser.",
+ "pywikibot-fixes-html": "Bot: conversie/reparatie HTML",
+ "pywikibot-fixes-syntax": "Bot: reparatie wikisyntaxis"
}
diff --git a/pywikibot/pl.json b/pywikibot/pl.json
index 6ab16af..5246b1c 100644
--- a/pywikibot/pl.json
+++ b/pywikibot/pl.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Leszek Krupiński",
"Matma Rex",
"Woytecr"
]
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Wpisz numer przestrzeni nazw:",
"pywikibot-enter-new-text": "Wpisz nowy tekst:",
"pywikibot-enter-category-name": "Wpisz nazwę kategorii:",
- "pywikibot-enter-finished-browser": "Wciśnij Enter, gdy przeglądarka zakończy pracę."
+ "pywikibot-enter-finished-browser": "Wciśnij Enter, gdy przeglądarka zakończy pracę.",
+ "pywikibot-fixes-html": "Robot konwertuje/naprawia HTML",
+ "pywikibot-fixes-syntax": "Robot poprawia wiki-składnię"
}
diff --git a/pywikibot/pt.json b/pywikibot/pt.json
index 2e515c6..9524278 100644
--- a/pywikibot/pt.json
+++ b/pywikibot/pt.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"Alchimista",
+ "Leonardo Gregianin",
"Malafaya",
"Vitorvicentevalente"
]
@@ -12,5 +13,7 @@
"pywikibot-enter-namespace-number": "Por favor, introduza um domínio pelo seu número:",
"pywikibot-enter-new-text": "Por favor, introduza o novo texto:",
"pywikibot-enter-category-name": "Por favor, introduza o nome da categoria:",
- "pywikibot-enter-finished-browser": "Pressione Enter quando terminar no navegador"
-}
+ "pywikibot-enter-finished-browser": "Pressione Enter quando terminar no navegador",
+ "pywikibot-fixes-html": "Bot: Corrigindo HTML",
+ "pywikibot-fixes-syntax": "Bot: Corrigindo sintaxe wiki"
+}
\ No newline at end of file
diff --git a/pywikibot/qqq.json b/pywikibot/qqq.json
index cb5708c..00f9bee 100644
--- a/pywikibot/qqq.json
+++ b/pywikibot/qqq.json
@@ -1,10 +1,17 @@
{
- "@metadata": [],
+ "@metadata": {
+ "authors": [
+ "Fabian Neundorf"
+ ]
+ },
"pywikibot-enter-xml-filename": "Message displayed to the bot owner to enter the XML dump's filename.",
"pywikibot-enter-page-processing": "Question displayed to the bot owner which page should be processed.",
"pywikibot-enter-file-links-processing": "Question displayed to the bot owner processing links to a given file page.",
"pywikibot-enter-namespace-number": "Message displayed to the bot owner to enter a namespace by its number.",
"pywikibot-enter-new-text": "Message displayed to the bot owner to enter the new text.",
"pywikibot-enter-category-name": "Message displayed to the bot owner to enter the category name.",
- "pywikibot-enter-finished-browser": "Message displayed to the bot owner to press Enter button when browser edits are finished."
+ "pywikibot-enter-finished-browser": "Message displayed to the bot owner to press Enter button when browser edits are finished.",
+ "pywikibot-fixes-html": "Edit summary for the HTML fixes.",
+ "pywikibot-fixes-syntax": "Edit summary for the syntax and syntax-safe fixes.",
+ "pywikibot-fixes-fckeditor": "Edit summary for fixes which convert HTML tags from FCK-editor to wiki syntax."
}
diff --git a/pywikibot/ru.json b/pywikibot/ru.json
index 860cd91..c8b5ad9 100644
--- a/pywikibot/ru.json
+++ b/pywikibot/ru.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Dmitry Nikitin",
"Eleferen",
"Rubin16"
]
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Пожалуйста, введите номер пространства имён:",
"pywikibot-enter-new-text": "Пожалуйста, введите новый текст:",
"pywikibot-enter-category-name": "Пожалуйста, введите название категории:",
- "pywikibot-enter-finished-browser": "Нажмите клавишу Enter, когда закончите вносить изменения в браузере."
+ "pywikibot-enter-finished-browser": "Нажмите клавишу Enter, когда закончите вносить изменения в браузере.",
+ "pywikibot-fixes-html": "Бот: коррекция HTML",
+ "pywikibot-fixes-syntax": "Бот: Коррекция вики синтаксиса"
}
diff --git a/pywikibot/sr.json b/pywikibot/sr.json
index cb2271b..c86294e 100644
--- a/pywikibot/sr.json
+++ b/pywikibot/sr.json
@@ -2,7 +2,8 @@
"@metadata": {
"authors": [
"Milicevic01",
- "Rancher"
+ "Rancher",
+ "Sasa Stefanovic"
]
},
"pywikibot-enter-xml-filename": "Унесите назив XML исписа:",
@@ -11,5 +12,7 @@
"pywikibot-enter-namespace-number": "Унесите именски простор поред његовог броја:",
"pywikibot-enter-new-text": "Унесите нови текст:",
"pywikibot-enter-category-name": "Унесите назив категорије:",
- "pywikibot-enter-finished-browser": "Притисните Enter када завршите у прегледачу."
+ "pywikibot-enter-finished-browser": "Притисните Enter када завршите у прегледачу.",
+ "pywikibot-fixes-html": "Бот: Поправка HTML-а",
+ "pywikibot-fixes-syntax": "Бот: Поправка вики синтаксе"
}
diff --git a/pywikibot/sv.json b/pywikibot/sv.json
index 620bda3..44a2c2a 100644
--- a/pywikibot/sv.json
+++ b/pywikibot/sv.json
@@ -3,6 +3,7 @@
"authors": [
"Cybjit",
"Lokal Profil",
+ "skorpan",
"WikiPhoenix"
]
},
@@ -12,5 +13,6 @@
"pywikibot-enter-namespace-number": "Ange namnrymden via dess nummer:",
"pywikibot-enter-new-text": "Skriv in den nya texten:",
"pywikibot-enter-category-name": "Ange kategorinamnet:",
- "pywikibot-enter-finished-browser": "Tryck på Enter när du är klar i webbläsaren."
+ "pywikibot-enter-finished-browser": "Tryck på Enter när du är klar i webbläsaren.",
+ "pywikibot-fixes-html": "Bot: Konverterar/korrigerar HTML"
}
diff --git a/pywikibot/uk.json b/pywikibot/uk.json
index b92f9b9..e3a1f58 100644
--- a/pywikibot/uk.json
+++ b/pywikibot/uk.json
@@ -3,7 +3,8 @@
"authors": [
"A1",
"Base",
- "DixonD"
+ "DixonD",
+ "Dmitry Nikitin"
]
},
"pywikibot-enter-xml-filename": "Будь ласка, введіть назву файлу дампу XML:",
@@ -12,5 +13,7 @@
"pywikibot-enter-namespace-number": "Введіть номер простору імен:",
"pywikibot-enter-new-text": "Введіть новий текст:",
"pywikibot-enter-category-name": "Введіть ім'я категорії:",
- "pywikibot-enter-finished-browser": "Натисніть Enter, коли завершите редагування у браузері."
+ "pywikibot-enter-finished-browser": "Натисніть Enter, коли завершите редагування у браузері.",
+ "pywikibot-fixes-html": "Бот: корекцiя HTML",
+ "pywikibot-fixes-syntax": "Бот: Корекцiя вiкi-синтаксису"
}
diff --git a/pywikibot/zh.json b/pywikibot/zh.json
index dca8d48..b5b1a77 100644
--- a/pywikibot/zh.json
+++ b/pywikibot/zh.json
@@ -1,6 +1,7 @@
{
"@metadata": {
"authors": [
+ "Alex Shih-Han Lin",
"Anakmalaysia",
"Liuxinyu970226",
"Qiyue2001",
@@ -13,5 +14,7 @@
"pywikibot-enter-namespace-number": "请输入命名空间编号:",
"pywikibot-enter-new-text": "请输入新文本:",
"pywikibot-enter-category-name": "请输入分类名称:",
- "pywikibot-enter-finished-browser": "请在浏览器作业完成后按下Enter键。"
+ "pywikibot-enter-finished-browser": "请在浏览器作业完成后按下Enter键。",
+ "pywikibot-fixes-html": "機器人: 轉換HTML",
+ "pywikibot-fixes-syntax": "機器人: 修正wiki語法"
}
--
To view, visit https://gerrit.wikimedia.org/r/190932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie29ba314a571b00f508e1cc95bc792dbef50af00
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Alex S.H. Lin <alexsh(a)mail2000.com.tw>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Use just "Pywikibot" as heading in README.rst
......................................................................
Use just "Pywikibot" as heading in README.rst
https://github.com/wikimedia/pywikibot-core does not look good
Change-Id: I820a689b216f8eb5461b5af105e980870b79d3c6
---
M README.rst
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README.rst b/README.rst
index d529a53..19e685e 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
-Pywikibot Framework
-===================
+Pywikibot
+=========
The Pywikibot framework is a Python library that interfaces with the
`MediaWiki API <https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page>`_
--
To view, visit https://gerrit.wikimedia.org/r/202000
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I820a689b216f8eb5461b5af105e980870b79d3c6
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Add JSON support to make_i18n_dict.py
......................................................................
Add JSON support to make_i18n_dict.py
It works simply like this
>>> from scripts.maintenance.make_i18n_dict import i18nBot
>>> bot = i18nBot('disambredir', 'msg')
>>> bot.to_json()
Bug: T87231
Change-Id: Ifcf93e18c3393f908caf80f86ad231ee21faca49
---
M scripts/maintenance/make_i18n_dict.py
1 file changed, 32 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py
index 590ead5..711c3d4 100644
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -15,6 +15,11 @@
If you have the messages as instance constants you may call the bot as follows:
>>> bot = i18nBot('<scriptname>.<class instance>', '<msg dict1>', '<msg dict2>')
+
+It's also possible to make json files too by using to_json method:
+>>> from scripts.maintenance.make_i18n_dict import i18nBot
+>>> bot = i18nBot('disambredir', 'msg')
+>>> bot.to_json()
"""
#
# (C) xqt, 2013-2014
@@ -24,6 +29,12 @@
#
__version__ = '$Id$'
#
+
+import os
+import json
+import codecs
+
+from pywikibot import config
class i18nBot(object):
@@ -88,5 +99,25 @@
self.read(msg)
self.print_all()
-if __name__ == "__main__":
+ def to_json(self):
+ if not self.dict:
+ self.run()
+ json_dir = os.path.join(
+ config.base_dir, 'scripts/i18n', self.scriptname)
+ if not os.path.exists(json_dir):
+ os.makedirs(json_dir)
+ for lang in self.dict:
+ file_name = os.path.join(json_dir, '%s.json' % lang)
+ if os.path.isfile(file_name):
+ with codecs.open(file_name, 'r', 'utf-8') as json_file:
+ new_dict = json.loads(json_file.read())
+ else:
+ new_dict = {}
+ new_dict['@metadata'] = new_dict.get('@metadata', {'authors': []})
+ with codecs.open(file_name, 'w', 'utf-8') as json_file:
+ new_dict.update(self.dict[lang])
+ json.dump(new_dict, json_file, ensure_ascii=False,
+ sort_keys=True, indent=4, separators=(',', ': '))
+
+if __name__ == '__main__':
print(__doc__)
--
To view, visit https://gerrit.wikimedia.org/r/201189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcf93e18c3393f908caf80f86ad231ee21faca49
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>