jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/917920 )
Change subject: [fix] Also raise ConnectionError if caused by NameResolutionError
......................................................................
[fix] Also raise ConnectionError if caused by NameResolutionError
Bug: T336280
Change-Id: Ia4047e6aa99e7b499115b8fe552d83a6aa56d8b9
---
M pywikibot/comms/http.py
1 file changed, 11 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 319f512..d467708 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -322,7 +322,7 @@
if isinstance(response, requests.ConnectionError):
msg = str(response)
- if 'NewConnectionError' in msg \
+ if ('NewConnectionError' in msg or 'NameResolutionError' in msg) \
and re.search(r'\[Errno (-2|8|11001)\]', msg):
raise ConnectionError(response)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/917920
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia4047e6aa99e7b499115b8fe552d83a6aa56d8b9
Gerrit-Change-Number: 917920
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/914798 )
Change subject: [IMPR] Deprecate -test option in transwikiimport.py
......................................................................
[IMPR] Deprecate -test option in transwikiimport.py
Global -simulate option should be used instead of -test. The option is
deprecated for now and will not be merged to stable 8.2.0 release.
Change-Id: I8ef555d23b1543b0c83833723f770860facac680
---
M scripts/transwikiimport.py
1 file changed, 38 insertions(+), 21 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/transwikiimport.py b/scripts/transwikiimport.py
index 6bd9335..44135b6 100644
--- a/scripts/transwikiimport.py
+++ b/scripts/transwikiimport.py
@@ -25,8 +25,6 @@
log and to the null revision on the imported
pages.
--test: No import, the names of the pages are output.
-
-overwrite: Existing pages are skipped by default.
Use this option to overwrite pages.
@@ -106,18 +104,21 @@
imported and the usernames will be identified
(existing pages will be skipped.)
-The parameter -test disables the import and the bot prints the names
- of the pages that would be imported.
-Since the import of pages is a quite exceptionell process and potentially
- dangerous it should be made carefully and tested in advance.
-The -test parameter can help to find out which pages would be moved
- and what would be the target of the import.
-However it does not print the titles of the transcluded pages (e.g. templates)
- if -includealltemplates is set.
-This option is quite *dangerous*. If the title of an existing page on home wiki
- clashes with the title of one of the linked pages it would be *overritten*.
- The histories would be merged. (If the imported version is newer.)
- Even if -overwrite is not set the linked page *can be overwritten*.
+The global option -simulate disables the import and the bot prints the
+names of the pages that would be imported. Since the import of pages is
+a quite exceptionell process and potentially dangerous it should be made
+carefully and tested in advance.
+
+The -simulate option can help to find out which pages would be moved
+and what would be the target of the import. However it does not print
+the titles of the transcluded pages (e.g. templates) if
+-includealltemplates is set.
+
+This option is quite *dangerous*. If the title of an existing page on
+home wiki clashes with the title of one of the linked pages it would be
+*overritten*. The histories would be merged. (If the imported version is
+newer.) Even if -overwrite is not set the linked page *can be
+overwritten*.
Interwikisource
@@ -143,10 +144,11 @@
# Distributed under the terms of the MIT license.
#
import pywikibot
-from pywikibot import pagegenerators
+from pywikibot import config, pagegenerators
from pywikibot.backports import Dict
from pywikibot.bot import suggest_help
from pywikibot.data import api
+from pywikibot.tools import issue_deprecation_warning
docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816
@@ -303,12 +305,15 @@
params['interwikipage'] = fromtitle
if test:
- pywikibot.info(f'Simulation: {fromtitle} → '
- f'{targetpage.title(with_ns=True)}')
- else:
- api_query(tosite, params)
- pywikibot.info(fromtitle + ' → ' + page.title(with_ns=True)
- if target else totitle)
+ # -simulate may be given as an int to indicate waiting seconds
+ if not config.simulate:
+ config.simulate = True
+
+ # since 8.2.0; no deprecation period
+ issue_deprecation_warning('-test option', '-simulate')
+
+ api_query(tosite, params)
+ pywikibot.info(f'{fromtitle} → {targetpage}')
if __name__ == '__main__':
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/914798
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8ef555d23b1543b0c83833723f770860facac680
Gerrit-Change-Number: 914798
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged