jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582568 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: Ifbc9056222a9339517238f6afe38b7bb9cd6241a
---
M HISTORY.rst
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index e7f4b00..a5c3dc4 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,8 +4,13 @@
Current release
---------------
+* Outdated secure connection overrides were removed (T247668)
+* Check for all modules which are needed by a script within pwb.py wrapper
+* Check for all modules which are mandatory within pwb.py wrapper script
+* Enable -help option with similar search of pwb.py (T241217)
* compat module has been removed (T183085)
* Category.copyTo and Category.copyAndKeep methods have been removed
+* Site.page_restrictions() does no longer raise NoPage (T214286)
* Use site.userinfo getter instead of site._userinfo within api (T243794)
* Fix endprefix parameter in Category.articles() (T247201)
* Fix search for changed claims when saving entity (T246359)
--
To view, visit https://gerrit.wikimedia.org/r/582568
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: Ifbc9056222a9339517238f6afe38b7bb9cd6241a
Gerrit-Change-Number: 582568
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/576866 )
Change subject: [bugfix] Remove tests whether fake_useragents are always different
......................................................................
[bugfix] Remove tests whether fake_useragents are always different
- fake_useragent gives a random ua but it is nur sure whether they
are always different. But this doesn't care and tests are done
by the project itself already. Remove these test parts.
Bug: T246538
Change-Id: I51983771831b352106989359d1bb67dccc0a90d8
---
M tests/http_tests.py
1 file changed, 0 insertions(+), 28 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/http_tests.py b/tests/http_tests.py
index d456024..4e7f56d 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -306,27 +306,6 @@
self.assertIn('Python/' + str(PYTHON_VERSION[0]), http.user_agent())
-class DryFakeUserAgentTestCase(TestCase):
-
- """Test the generation of fake user agents.
-
- If the method cannot import fake_useragent, the default user agent
- will be returned, causing tests to fail. Therefore tests will skip
- if fake_useragent is missing.
- """
-
- net = False
-
- def _test_fake_user_agent_randomness(self):
- """Test if user agent returns are randomized."""
- self.assertNotEqual(http.fake_user_agent(), http.fake_user_agent())
-
- @require_modules('fake_useragent')
- def test_with_fake_useragent(self):
- """Test fake user agent generation with fake_useragent module."""
- self._test_fake_user_agent_randomness()
-
-
class LiveFakeUserAgentTestCase(HttpbinTestCase):
"""Test the usage of fake user agent."""
@@ -392,12 +371,6 @@
config.fake_user_agent = self.orig_fake_user_agent
super(GetFakeUserAgentTestCase, self).tearDown()
- def _test_fake_user_agent_randomness(self):
- """Test if user agent returns are randomized."""
- config.fake_user_agent = True
- self.assertNotEqual(http.get_fake_user_agent(),
- http.get_fake_user_agent())
-
def _test_config_settings(self):
"""Test if method honours configuration toggle."""
# ON: True and None in config are considered turned on.
@@ -415,7 +388,6 @@
@require_modules('fake_useragent')
def test_with_fake_useragent(self):
"""Test method with fake_useragent module."""
- self._test_fake_user_agent_randomness()
self._test_config_settings()
--
To view, visit https://gerrit.wikimedia.org/r/576866
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: I51983771831b352106989359d1bb67dccc0a90d8
Gerrit-Change-Number: 576866
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/579759 )
Change subject: [cleanup] Remove "panoramio" and "special_page_limit" settings in config2.py
......................................................................
[cleanup] Remove "panoramio" and "special_page_limit" settings in config2.py
With I570d822dc a deprecation warning is printed if a deprecated variable
is set inside user-config.py but not exists in config2.py
Change-Id: Ic0025b602d01837172ef80fc32772cd9b847d6c7
---
M pywikibot/config2.py
1 file changed, 3 insertions(+), 9 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 0b7b20a..328ac84 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -111,9 +111,9 @@
# to other modules.
_private_values = {'authenticate', 'db_password'}
-_deprecated_variables = {'use_SSL_onlogin', 'use_SSL_always',
- 'available_ssl_project', 'fake_user_agent',
- 'special_page_limit', 'sysopnames', 'proxy'}
+_deprecated_variables = {'available_ssl_project', 'fake_user_agent',
+ 'panoramio', 'proxy', 'special_page_limit',
+ 'sysopnames', 'use_SSL_onlogin', 'use_SSL_always'}
# ############# ACCOUNT SETTINGS ##############
@@ -903,12 +903,6 @@
# This section contains configuration options that are no longer in use.
# They are kept here to prevent warnings about undefined parameters.
-panoramio = {
- 'review': False, # Do we use automatically make our uploads reviewed?
- 'reviewer': '', # If so, under what reviewer name?
-}
-
-special_page_limit = 500
sysopnames = collections.defaultdict(dict)
# #############################################
--
To view, visit https://gerrit.wikimedia.org/r/579759
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: Ic0025b602d01837172ef80fc32772cd9b847d6c7
Gerrit-Change-Number: 579759
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/579756 )
Change subject: [cleanup] Remove outdated secure connection overrides
......................................................................
[cleanup] Remove outdated secure connection overrides
- Remove secure connection override settings from config2.py
and show a related warning
- remove EnableSSLSiteWrapper from api.py which is no longer needed
Bug: T247668
Change-Id: I570d822dc810331bb9cb9cbae2a9bd27960180cd
---
M pywikibot/config2.py
M pywikibot/data/api.py
2 files changed, 18 insertions(+), 49 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 08de9c4..0b7b20a 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -51,6 +51,7 @@
from distutils.version import StrictVersion
from locale import getdefaultlocale
from os import getenv, environ
+from textwrap import fill
from warnings import warn
from requests import __version__ as requests_version
@@ -215,17 +216,6 @@
# Note: the target wiki site must install OAuth extension
authenticate = {}
-#
-# Secure connection overrides
-#
-# These settings are deprecated. They existed to support the Wikimedia
-# family which only served HTTPS on https://secure.wikimedia.org/<site>/<uri>
-# Use Family.protocol()
-use_SSL_onlogin = False # if available, use SSL when logging in
-use_SSL_always = False # if available, use SSL for all API queries
-# Available secure projects should be listed here.
-available_ssl_project = []
-
# By default you are asked for a password on the terminal.
# A password file may be used, e.g. password_file = '.passwd'
# The path to the password file is relative to that of the user_config file.
@@ -1080,6 +1070,12 @@
raise _DifferentTypeError(name, type(value), types)
+DEPRECATED_VARIABLE = (
+ '"{}" present in our user-config.py is no longer a supported '
+ 'configuration variable and should be removed. Please inform the '
+ 'maintainers if you depend on it.')
+
+
def _check_user_config_types(user_config, default_values, skipped):
"""Check the types compared to the default values."""
for name, value in user_config.items():
@@ -1095,15 +1091,19 @@
else:
user_config[name] = value
elif not name.startswith('_') and name not in skipped:
- warn('Configuration variable "{0}" is defined in your '
- 'user-config.py but unknown. It can be a misspelled one or a '
- 'variable that is no longer supported.'
- .format(name), UserWarning)
+ if name in _deprecated_variables:
+ warn('\n' + fill(DEPRECATED_VARIABLE.format(name)),
+ _ConfigurationDeprecationWarning)
+ else:
+ warn('\n'
+ + fill('Configuration variable "{0}" is defined in your '
+ 'user-config.py but unknown. It can be a '
+ 'misspelled one or a variable that is no longer '
+ 'supported.'.format(name)), UserWarning)
_check_user_config_types(_exec_globals, _public_globals, _imports)
-
# Copy the user config settings into globals
_modified = {_key for _key in _public_globals.keys()
if _exec_globals[_key] != globals()[_key]}
@@ -1122,9 +1122,8 @@
globals()[_key] = _exec_globals[_key]
if _key in _deprecated_variables:
- warn('"{0}" present in our user-config.py is no longer a supported '
- 'configuration variable. Please inform the maintainers if you '
- 'depend on it.'.format(_key), _ConfigurationDeprecationWarning)
+ warn(DEPRECATED_VARIABLE.format(_key),
+ _ConfigurationDeprecationWarning)
# If we cannot auto-detect the console encoding (e.g. when piping data)
# assume utf-8. On Linux, this will typically be correct; on windows,
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 381e21a..5a9922f 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1044,31 +1044,6 @@
return len(self._enabled) + len(self._disabled)
-class EnableSSLSiteWrapper(object):
-
- """Wrapper to change the site protocol to https."""
-
- def __init__(self, site):
- """Initializer."""
- self._site = site
-
- def __repr__(self):
- """Return internal representation."""
- return repr(self._site)
-
- def __eq__(self, other):
- """Compare two objects."""
- return self._site == other
-
- def __getattr__(self, attr):
- """Access object's site attributes."""
- return getattr(self._site, attr)
-
- def protocol(self):
- """Return protocol."""
- return 'https'
-
-
class Request(MutableMapping):
"""A request to a Site's api.php interface.
@@ -1276,11 +1251,6 @@
pywikibot.debug('Adding user assertion', _logger)
self['assert'] = 'user' # make sure user is logged in
- if (self.site.protocol() == 'http' and (config.use_SSL_always or (
- self.action == 'login' and config.use_SSL_onlogin))
- and self.site.family.name in config.available_ssl_project):
- self.site = EnableSSLSiteWrapper(self.site)
-
@classmethod
def create_simple(cls, site, **kwargs):
"""Create a new instance using all args except site for the API."""
--
To view, visit https://gerrit.wikimedia.org/r/579756
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: I570d822dc810331bb9cb9cbae2a9bd27960180cd
Gerrit-Change-Number: 579756
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/578002 )
Change subject: [IMPR] Check for all modules which are needed by a script
......................................................................
[IMPR] Check for all modules which are needed by a script
This patch enables checking for all required modules which
are needed by a script for a give Python release. This
ensures that the package has to be updated if necessary
but always run a script with -help option.
Change-Id: I201d05f147abd0bb2bd552586a351af0fc606124
---
M pwb.py
1 file changed, 16 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index f741091..228c307 100755
--- a/pwb.py
+++ b/pwb.py
@@ -139,10 +139,19 @@
return fname, list(args[index + int(bool(fname)):]), args[:index]
-def check_modules():
+def check_modules(script=None):
"""Check whether mandatory modules are present."""
import pkg_resources
- from setup import dependencies
+ if script:
+ from setup import script_deps
+ try:
+ from pathlib import Path
+ except ImportError: # Python 2
+ from pathlib2 import Path
+ dependencies = script_deps.get(Path(script).name, [])
+ else:
+ from setup import dependencies
+
missing_requirements = []
for requirement in pkg_resources.parse_requirements(dependencies):
@@ -347,10 +356,11 @@
warn('Parent module %s not found: %s'
% (file_package, e), ImportWarning)
- run_python_file(filename,
- [filename] + args,
- [Path(relative_filename).stem] + argvu[1:],
- file_package)
+ if check_modules(filename) or '-help' in args:
+ run_python_file(filename,
+ [filename] + args,
+ [Path(relative_filename).stem] + argvu[1:],
+ file_package)
return True
--
To view, visit https://gerrit.wikimedia.org/r/578002
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: I201d05f147abd0bb2bd552586a351af0fc606124
Gerrit-Change-Number: 578002
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/578299 )
Change subject: [bugfix] Enable -help option with similar search of pwb.py
......................................................................
[bugfix] Enable -help option with similar search of pwb.py
- Use pathlib.Path to get the final path component, without its suffix
needed for calledModuleName.
- pathlib is mandatory for Python 2
Bug: T241217
Change-Id: If148b2d94a8b6be5f4821d6515a197b13912f1f5
---
M pwb.py
1 file changed, 10 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 945694f..3886e8e 100755
--- a/pwb.py
+++ b/pwb.py
@@ -14,7 +14,7 @@
python pwb.py -lang:de bot_tests -v
"""
-# (C) Pywikibot team, 2012-2019
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
@@ -184,6 +184,11 @@
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)
+try:
+ from pathlib import Path
+except ImportError: # Python 2
+ from pathlib2 import Path
+
def find_alternates(filename, script_paths):
"""Search for similar filenames in the given script paths."""
@@ -317,7 +322,10 @@
warn('Parent module %s not found: %s'
% (file_package, e), ImportWarning)
- run_python_file(filename, [filename] + args, argvu, file_package)
+ run_python_file(filename,
+ [filename] + args,
+ [Path(relative_filename).stem] + argvu[1:],
+ file_package)
return True
--
To view, visit https://gerrit.wikimedia.org/r/578299
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: If148b2d94a8b6be5f4821d6515a197b13912f1f5
Gerrit-Change-Number: 578299
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/578349 )
Change subject: [tests] skip SearchTestCase.test_search if code is 'gsrsearch-text-disabled'
......................................................................
[tests] skip SearchTestCase.test_search if code is 'gsrsearch-text-disabled'
Bug: T247249
Change-Id: Ia7179ec20cf413e891a6c6c5ec04a2b4dafd9f79
---
M tests/site_tests.py
1 file changed, 5 insertions(+), 3 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 0dd079f..f1b9e2f 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1691,9 +1691,11 @@
self.assertEqual(hit.namespace(), 0)
except pywikibot.data.api.APIError as e:
if e.code == 'gsrsearch-error' and 'timed out' in e.info:
- self.skipTest('gsrsearch returned timeout on site: {!r}'
- .format(e))
- raise
+ self.skipTest('gsrsearch returned timeout on site{}:\n{!r}'
+ .format(mysite, e))
+ if e.code == 'gsrsearch-text-disabled':
+ self.skipTest('gsrsearch is diabled on site {}:\n{!r}'
+ .format(mysite, e))
@suppress_warnings("where='title' is deprecated", DeprecationWarning)
def test_search_where_title(self):
--
To view, visit https://gerrit.wikimedia.org/r/578349
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: Ia7179ec20cf413e891a6c6c5ec04a2b4dafd9f79
Gerrit-Change-Number: 578349
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: jenkins-bot (75)