jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/904767 )
Change subject: [test] stdnum 1.18+ is required, force it for tests
......................................................................
[test] stdnum 1.18+ is required, force it for tests
Change-Id: Id1cbcfbd5250e7c0f58c1e7f23511203123c5715
---
M tests/cosmetic_changes_tests.py
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 9073fac..4c41716 100755
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -562,7 +562,7 @@
@classmethod
def setUpClass(cls):
"""Skip tests if isbn libraries are missing."""
- if not has_module('stdnum', version='1.17'):
+ if not has_module('stdnum', version='1.18'):
raise unittest.SkipTest('python-stdnum is not available.')
super().setUpClass()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/904767
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: Id1cbcfbd5250e7c0f58c1e7f23511203123c5715
Gerrit-Change-Number: 904767
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/i18n/+/904454 )
Change subject: [i18n] Fix protect-ref and unprotect-ref messages
......................................................................
[i18n] Fix protect-ref and unprotect-ref messages
https://translatewiki.net/wiki/Thread:Support/About_Pywikibot:Protect-ref/e…
Change-Id: Ibb924c42716448be013eac1bddbf0724e8fea2e0
---
M protect/qqq.json
M unprotect/en.json
M protect/en.json
3 files changed, 21 insertions(+), 5 deletions(-)
Approvals:
MarcoAurelio: Looks good to me, approved
jenkins-bot: Verified
diff --git a/protect/en.json b/protect/en.json
index d523d9f..2df38e6 100644
--- a/protect/en.json
+++ b/protect/en.json
@@ -1,8 +1,12 @@
{
- "@metadata": [],
+ "@metadata": {
+ "authors": [
+ "Xqt"
+ ]
+ },
"protect-category": "Bot: Protecting all pages from category %(cat)s",
"protect-images": "Bot: Protecting all images on page %(page)s",
"protect-links": "Bot: Protecting all pages linked from %(page)s",
- "protect-ref": "Bot: Protecting all pages referring from %(page)s",
+ "protect-ref": "Bot: Protecting all pages referring to %(page)s",
"protect-simple": "Bot: Protecting a list of files."
}
diff --git a/protect/qqq.json b/protect/qqq.json
index 4dd80cf..61d8a22 100644
--- a/protect/qqq.json
+++ b/protect/qqq.json
@@ -10,6 +10,6 @@
"protect-category": "Edit summary when the bot protects all pages from a category. Parameters:\n* %(cat)s - category name\nSee also:\n* {{msg-pywikibot|Delete-from-category}}",
"protect-images": "Edit summary when the bot protects all images on a page. Parameters:\n* %(page)s - page title\nSee also:\n* {{msg-pywikibot|Delete-images}}",
"protect-links": "Edit summary when the bot protects all pages linked from a page. Parameters:\n* $(page)s - page title\nSee also:\n* {{msg-pywikibot|Delete-linked-pages}}",
- "protect-ref": "Edit summary when the bot protects all pages that link to/transclude a page (Special:WhatLinksHere); \"referring from\" can also be translated as \"linked from\". Parameters:\n* %(page)s - page title\nSee also:\n* {{msg-pywikibot|Delete-referring-pages}}",
+ "protect-ref": "Edit summary when the bot protects all pages that link to/transclude a page (Special:WhatLinksHere); \"referring to\" can also be translated as \"linked from\". Parameters:\n* %(page)s - page title\nSee also:\n* {{msg-pywikibot|Delete-referring-pages}}",
"protect-simple": "Edit summary when the bot protects a list of files."
}
diff --git a/unprotect/en.json b/unprotect/en.json
index 464d57b..ea886f7 100644
--- a/unprotect/en.json
+++ b/unprotect/en.json
@@ -1,12 +1,13 @@
{
"@metadata": {
"authors": [
- "Sn1per"
+ "Sn1per",
+ "Xqt"
]
},
"unprotect-category": "Bot: Unprotecting all pages from category %(cat)s",
"unprotect-images": "Bot: Unprotecting all files on page %(page)s",
"unprotect-links": "Bot: Unprotecting all pages linked from %(page)s",
- "unprotect-ref": "Bot: Unprotecting all pages referring from %(page)s",
+ "unprotect-ref": "Bot: Unprotecting all pages referring to %(page)s",
"unprotect-simple": "Bot: Unprotecting a list of files"
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/904454
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: Ibb924c42716448be013eac1bddbf0724e8fea2e0
Gerrit-Change-Number: 904454
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: MarcoAurelio <maurelio(a)toolforge.org>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/904451 )
Change subject: [i18n] Remove fullstop at the end of the message
......................................................................
[i18n] Remove fullstop at the end of the message
https://translatewiki.net/wiki/Thread:Translating_talk:Pywikibot/About_Pywi…
Change-Id: Ic64bb190d4a8311aab260e84745e82048bc8b533
---
M delinker/en.json
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/delinker/en.json b/delinker/en.json
index eb4bbf7..bf153b8 100644
--- a/delinker/en.json
+++ b/delinker/en.json
@@ -4,5 +4,5 @@
"Xqt"
]
},
- "delinker-delink": "Bot: The file [[%(title)s]] has been removed, as it has been deleted by [[:User:%(user)s]]: ''%(comment)s''."
+ "delinker-delink": "Bot: The file [[%(title)s]] has been removed, as it has been deleted by [[:User:%(user)s]]: ''%(comment)s''"
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/904451
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: Ic64bb190d4a8311aab260e84745e82048bc8b533
Gerrit-Change-Number: 904451
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/+/904272 )
Change subject: [IMPR] us f-strings in archivebot.py
......................................................................
[IMPR] us f-strings in archivebot.py
Change-Id: Ie8362feec9d715e0d538bd1b40a9a6c7d138ae17
---
M scripts/archivebot.py
1 file changed, 25 insertions(+), 28 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index baba69b..f499e02 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -163,8 +163,7 @@
class MissingConfigError(ArchiveBotSiteConfigError):
- """
- The config is missing in the header.
+ """The config is missing in the header.
It's in one of the threads or transcluded from another page.
"""
@@ -172,8 +171,7 @@
class ArchiveSecurityError(ArchiveBotSiteConfigError):
- """
- Page title is not a valid archive of page being archived.
+ """Page title is not a valid archive of page being archived.
The page title is neither a subpage of the page being archived,
nor does it match the key specified in the archive configuration template.
@@ -181,8 +179,7 @@
def str2localized_duration(site, string: str) -> str:
- """
- Localise a shorthand duration.
+ """Localise a shorthand duration.
Translates a duration written in the shorthand notation (ex. "24h", "7d")
into an expression in the local wiki language ("24 hours", "7 days").
@@ -200,8 +197,7 @@
def str2size(string: str) -> Size:
- """
- Return a size for a shorthand size.
+ """Return a size for a shorthand size.
Accepts a string defining a size::
@@ -227,8 +223,7 @@
def template_title_regex(tpl_page: pywikibot.Page) -> Pattern:
- """
- Return a regex that matches to variations of the template title.
+ """Return a regex that matches to variations of the template title.
It supports the transcluding variant as well as localized namespaces and
case-insensitivity depending on the namespace.
@@ -296,8 +291,7 @@
self.timestamp = max(self.timestamp, timestamp)
def size(self) -> int:
- """
- Return size of discussion thread.
+ """Return size of discussion thread.
Note that the result is NOT equal to that of
len(self.to_text()). This method counts bytes, rather than
@@ -314,8 +308,7 @@
class DiscussionPage(pywikibot.Page):
- """
- A class that represents a single page of discussion threads.
+ """A class that represents a single page of discussion threads.
Feed threads to it and run an update() afterwards.
"""
@@ -411,8 +404,7 @@
# This extra info is not desirable when run under the unittest
# framework, which may be run either directly or via setup.py
if pywikibot.calledModuleName() not in ['archivebot_tests', 'setup']:
- pywikibot.info('{} thread(s) found on {}'
- .format(len(self.threads), self))
+ pywikibot.info(f'{len(self.threads)} thread(s) found on {self}')
def is_full(self, max_archive_size: Size) -> bool:
"""Check whether archive size exceeded."""
@@ -551,8 +543,8 @@
def load_config(self) -> None:
"""Load and validate archiver template."""
- pywikibot.info('Looking for: {{{{{}}}}} in {}'
- .format(self.tpl.title(), self.page))
+ pywikibot.info(
+ f'Looking for: {{{{{self.tpl.title()}}}}} in {self.page}')
for tpl, params in self.page.raw_extracted_templates:
try: # Check tpl name before comparing; it might be invalid.
@@ -570,13 +562,12 @@
for field in ('algo', 'archive'):
if not self.get_attr(field, ''):
- raise MissingConfigError('Missing argument {!r} in template'
- .format(field))
+ raise MissingConfigError(
+ f'Missing argument {field!r} in template')
def should_archive_thread(self, thread: DiscussionThread
) -> Optional[ShouldArchive]:
- """
- Check whether a thread has to be archived.
+ """Check whether a thread has to be archived.
:return: the archivation reason as a tuple of localization args
"""
@@ -640,8 +631,7 @@
max_size = self.get_attr('maxarchivesize')
max_arch_size = str2size(max_size)
if not max_arch_size[0]:
- raise MalformedConfigError('invalid maxarchivesize {!r}'
- .format(max_size))
+ raise MalformedConfigError(f'invalid maxarchivesize {max_size!r}')
counter = int(self.get_attr('counter', '1'))
pattern = self.get_attr('archive')
@@ -831,11 +821,9 @@
archiver.run()
except ArchiveBotSiteConfigError as e:
# no stack trace for errors originated by pages on-site
- pywikibot.error('Missing or malformed template in page {}: {}'
- .format(page, e))
+ pywikibot.error(f'Missing or malformed template in page {page}: {e}')
except Exception:
- pywikibot.exception('Error occurred while processing page {}'
- .format(page))
+ pywikibot.exception(f'Error occurred while processing page {page}')
except KeyboardInterrupt:
pywikibot.info('\nUser quit bot run...')
return False
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/904272
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: Ie8362feec9d715e0d538bd1b40a9a6c7d138ae17
Gerrit-Change-Number: 904272
Gerrit-PatchSet: 1
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
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/902844 )
Change subject: [doc] Update documentation
......................................................................
[doc] Update documentation
Change-Id: I23efbf6285181eeecbb4f8fbf329f41209f01d13
---
M ROADMAP.rst
M pywikibot/site/_apisite.py
M pywikibot/proofreadpage.py
3 files changed, 20 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index afc57ca..a072b85 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,12 +1,18 @@
Current release
---------------
+* :exc:`exceptions.ClientError` was added
+* Raise :exc:`exceptions.NoPageError` when deleting a missing Page (:phab:`T332924`)
+* ``text`` parameter of :class:`proofreadpage.PagesTagParser` has a default value
+* Ignore talk pages with :meth:`APISite.watched_pages()<pywikibot.site._generators.GeneratorsMixin.watched_pages>` (:phab:`T330806`)
+* Load page info when creating a page if not updated previously (:phab:`T330980`)
* Improve flush exception logging
Deprecations
------------
+* 8.1.0: ``exceptions.Server414Error`` is deprecated in favour of :exc:`exceptions.Client414Error`
* 8.0.0: :meth:`Timestamp.clone()<pywikibot.time.Timestamp.clone>` method is deprecated
in favour of ``Timestamp.replace()`` method.
* 8.0.0: :meth:`family.Family.maximum_GET_length` method is deprecated in favour of
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index e7151ce..da052e2 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -273,6 +273,8 @@
False
.. versionadded:: 8.0
+ .. versionchanged:: 8.1
+ *text* parameter is defaulted to ``'<pages />'``.
"""
pat_tag = re.compile(r'<pages (?P<attrs>[^/]*?)/>')
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index cca3beb..48682f4 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2401,6 +2401,9 @@
.. versionchanged:: 7.1
keyword only parameter `deletetalk` was added.
+ .. versionchanged:: 8.1
+ raises :exc:`exceptions.NoPageError` if page does not exist.
+
:param page: Page to be deleted or its pageid.
:param reason: Deletion reason.
:param deletetalk: Also delete the talk page, if it exists.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/902844
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: I23efbf6285181eeecbb4f8fbf329f41209f01d13
Gerrit-Change-Number: 902844
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/+/894207 )
Change subject: [IMPR] Add ClientError for http status 4XX
......................................................................
[IMPR] Add ClientError for http status 4XX
- add ClientError for http status 400-451
- rename Server414Error to Client414Error
- raise ClientError with site_detect.check_response()
in addition to ServerError
- raise Client414Error with http.error_handling_callback()
- check for Client414Error with Request._http_request()
Change-Id: Ie125730837db50d4143d9b4f656b2bd4d9f01430
---
M pywikibot/exceptions.py
M pywikibot/comms/http.py
M pywikibot/site_detect.py
M pywikibot/data/api/_requests.py
4 files changed, 81 insertions(+), 37 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 77128be..319f512 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -48,8 +48,8 @@
from pywikibot import config, tools
from pywikibot.backports import Tuple
from pywikibot.exceptions import (
+ Client414Error,
FatalServerError,
- Server414Error,
Server504Error,
ServerError,
)
@@ -333,7 +333,7 @@
raise response from None
if response.status_code == HTTPStatus.REQUEST_URI_TOO_LONG:
- raise Server414Error('Too long GET request')
+ raise Client414Error(HTTPStatus(response.status_code).description)
if response.status_code == HTTPStatus.GATEWAY_TIMEOUT:
raise Server504Error('Server {} timed out'
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 9d4dc8e..ebdbe9e 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -25,11 +25,11 @@
from pywikibot.backports import Callable, Dict, Match, Tuple, removeprefix
from pywikibot.comms import http
from pywikibot.exceptions import (
+ Client414Error,
Error,
FatalServerError,
MaxlagTimeoutError,
NoUsernameError,
- Server414Error,
Server504Error,
SiteDefinitionError,
TimeoutError,
@@ -687,13 +687,13 @@
data=data, headers=headers)
except Server504Error:
pywikibot.log('Caught HTTP 504 error; retrying')
- except Server414Error:
+ except Client414Error:
if use_get:
pywikibot.log('Caught HTTP 414 error; retrying')
use_get = False
else:
- pywikibot.warning('Caught HTTP 414 error, although not '
- 'using GET.')
+ pywikibot.warning(
+ 'Caught HTTP 414 error, although not using GET.')
raise
except (ConnectionError, FatalServerError):
# This error is not going to be fixed by just waiting
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 654e579..36da84e 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -10,6 +10,8 @@
| +-- UploadError
+-- AutoblockUserError
+-- CaptchaError
+ +-- ClientError
+ | +-- Client414Error
+-- InvalidTitleError
+-- NoUsernameError
+-- PageInUseError
@@ -41,7 +43,6 @@
+-- SectionError
+-- ServerError
| +-- FatalServerError
- | +-- Server414Error
| +-- Server504Error
+-- SiteDefinitionError
| +-- UnknownFamilyError
@@ -68,17 +69,18 @@
Error: Base class, all exceptions should the subclass of this class.
- - NoUsernameError: Username is not in user config file, or it is invalid.
- - AutoblockUserError: requested action on a virtual autoblock user not valid
- - TranslationError: no language translation found
- - UserRightsError: insufficient rights for requested action
- - InvalidTitleError: Invalid page title
- CaptchaError: Captcha is asked and config.solve_captcha == False
- - i18n.TranslationError: i18n/l10n message not available
+ - ClientError: A problem with the client request
+ - AutoblockUserError: requested action on a virtual autoblock user not valid
+ - InvalidTitleError: Invalid page title
+ - NoUsernameError: Username is not in user config file, or it is invalid.
- PageInUseError: Page cannot be reserved due to a lock
- - UnknownExtensionError: Extension is not defined for this site
- - VersionParseError: failed to parse version information
- SectionError: The section specified by # does not exist
+ - TranslationError: no language translation found
+ - UnknownExtensionError: Extension is not defined for this site
+ - UserRightsError: insufficient rights for requested action
+ - VersionParseError: failed to parse version information
+ - i18n.TranslationError: i18n/l10n message not available
APIError: wiki API returned an error
@@ -160,9 +162,13 @@
All Pywikibot Error exceptions must be imported from
``pywikibot.exceptions``. Deprecated exceptions identifiers were
removed.
+
+.. versionchanged:: 8.1
+ ``Server414Error`` class is deprecated; use :class:`Client414Error`
+ instead.
"""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2023
#
# Distributed under the terms of the MIT license.
#
@@ -170,7 +176,7 @@
from typing import Any, Optional, Union
import pywikibot
-from pywikibot.tools import issue_deprecation_warning
+from pywikibot.tools import ModuleDeprecationWrapper, issue_deprecation_warning
from pywikibot.tools._deprecate import _NotImplementedWarning
@@ -576,6 +582,22 @@
message = 'Page {} is title-blacklisted.'
+class ClientError(Error):
+
+ """Got unexpected server response due to client issue.
+
+ .. versionadded:: 8.1
+ """
+
+
+class Client414Error(ClientError):
+
+ """Server returned with HTTP 414 code.
+
+ .. versionadded:: 8.1
+ """
+
+
class ServerError(Error):
"""Got unexpected server response."""
@@ -591,11 +613,6 @@
"""Server timed out with HTTP 504 code."""
-class Server414Error(ServerError):
-
- """Server returned with HTTP 414 code."""
-
-
class CaptchaError(Error):
"""Captcha is asked and config.solve_captcha == False."""
@@ -681,3 +698,8 @@
class MaxlagTimeoutError(TimeoutError):
"""Request failed with a maxlag timeout error."""
+
+
+wrapper = ModuleDeprecationWrapper(__name__)
+wrapper.add_deprecated_attr(
+ 'Server414Error', Client414Error, since='8.1.0')
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 8a266d2..5dde965 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -17,7 +17,7 @@
import pywikibot
from pywikibot.backports import removesuffix
from pywikibot.comms.http import fetch
-from pywikibot.exceptions import ServerError
+from pywikibot.exceptions import ClientError, ServerError
from pywikibot.tools import MediaWikiVersion
@@ -280,25 +280,31 @@
def check_response(response):
- """Raise ServerError if the response indicates a server error.
+ """Raise ClientError or ServerError depending on http status.
.. versionadded:: 3.0
.. versionchanged:: 7.0
- Raise a generic ServerError if http status code is not
- IANA-registered but unofficial code
-
-
+ Raise a generic :class:`exceptions.ServerError` if http status
+ code is not IANA-registered but unofficial code
+ .. versionchanged:: 8.1
+ Raise a :class:`exceptions.ClientError` if status code is 4XX
"""
- if response.status_code >= HTTPStatus.INTERNAL_SERVER_ERROR:
- try:
- msg = HTTPStatus(response.status_code).phrase
- except ValueError as err:
- m = re.search(r'\d{3}', err.args[0], flags=re.ASCII)
- if not m:
- raise err
- msg = f'Generic Server Error ({m.group()})'
+ for status_code, err_class, err_type in [
+ (HTTPStatus.INTERNAL_SERVER_ERROR, ServerError, 'Server'),
+ (HTTPStatus.BAD_REQUEST, ClientError, 'Client')
+ ]: # highest http status code first
+ if response.status_code >= status_code:
+ try:
+ status = HTTPStatus(response.status_code).description
+ except ValueError as err:
+ m = re.search(r'\d{3}', err.args[0], flags=re.ASCII)
+ if not m:
+ raise err
+ msg = f'Generic {err_type} Error ({m.group()})'
+ else:
+ msg = f'({status}) {status.description}'
- raise ServerError(msg)
+ raise err_class(msg)
if response.status_code == HTTPStatus.OK \
and SERVER_DB_ERROR_MSG in response.text:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894207
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: Ie125730837db50d4143d9b4f656b2bd4d9f01430
Gerrit-Change-Number: 894207
Gerrit-PatchSet: 3
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/+/894675 )
Change subject: [impr] clean_sandbox: Use non-substed text for es.wikibooks
......................................................................
[impr] clean_sandbox: Use non-substed text for es.wikibooks
Change-Id: I6e98d3061a4ba3089209c8fa7d3ca8763af355ab
---
M scripts/clean_sandbox.py
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 10bca7c..0ca49cb 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -67,7 +67,7 @@
'== Please start your testing below this line ==',
'wikidata': '{{Please leave this line alone (sandbox heading)}}',
'wikibooks': {
- 'es': '{{subst:ZDP/2}}',
+ 'es': '{{ZDP}}\n== Haz tus pruebas bajo esta sección ==',
'ru': '{{/Шапка}}\n'
'<!-- Не удаляйте, пожалуйста, эту строку, '
'тестируйте ниже -->',
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894675
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: I6e98d3061a4ba3089209c8fa7d3ca8763af355ab
Gerrit-Change-Number: 894675
Gerrit-PatchSet: 2
Gerrit-Owner: MarcoAurelio <maurelio(a)toolforge.org>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
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/+/894653 )
Change subject: [IMPR] use f-string instead of format method
......................................................................
[IMPR] use f-string instead of format method
Change-Id: I24e99317d9eabc2cf5cd34eda9f43980e25e2028
---
M pywikibot/site/_basesite.py
1 file changed, 15 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index 92b79d7..a13cec7 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -316,27 +316,24 @@
try:
name = dp.getSitelink(self)
except NoPageError:
- raise Error(
- 'No disambiguation category name found in {repo} '
- 'for {site}'.format(repo=repo_name, site=self))
+ raise Error(f'No disambiguation category name found in {repo} '
+ f'for {self}')
else: # fallback for non WM sites
try:
name = '{}:{}'.format(Namespace.CATEGORY,
self.family.disambcatname[self.code])
except KeyError:
- raise Error(
- 'No disambiguation category name found in '
- '{site.family.name}_family for {site}'.format(site=self))
+ raise Error(f'No disambiguation category name found in '
+ f'{self.family.name}_family for {self}')
return pywikibot.Category(pywikibot.Link(name, self))
def isInterwikiLink(self, text): # noqa: N802
"""Return True if text is in the form of an interwiki link.
- If a link object constructed using "text" as the link text parses as
- belonging to a different site, this method returns True.
-
+ If a link object constructed using "text" as the link text parses
+ as belonging to a different site, this method returns True.
"""
linkfam, linkcode = pywikibot.Link(text, self).parse_site()
return linkfam != self.family.name or linkcode != self.code
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894653
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: I24e99317d9eabc2cf5cd34eda9f43980e25e2028
Gerrit-Change-Number: 894653
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/+/894530 )
Change subject: [tests] Ensure that login is made prior than rights are checked
......................................................................
[tests] Ensure that login is made prior than rights are checked
Bug: T331266
Change-Id: I19bdf4a7db13996a93cfbd8fbe5ad817931ab97c
---
M tests/aspects.py
1 file changed, 16 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 5ab221c..b011986 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -601,8 +601,7 @@
@classmethod
def setUpClass(cls):
- """
- Set up the test class.
+ """Set up the test class.
Skip the test class if the user config does not have
a valid login to the site.
@@ -853,12 +852,16 @@
bases = cls.add_base(bases, SiteWriteMixin)
if dct.get('rights'):
- bases = cls.add_base(bases, NeedRightsMixin)
dct.setdefault('login', True)
if dct.get('login'):
bases = cls.add_base(bases, RequireLoginMixin)
+ # Add NeedRightsMixin after RequireLoginMixin to ensure
+ # login is made prior to rights check
+ if dct.get('rights'):
+ bases = cls.add_base(bases, NeedRightsMixin)
+
for test in tests:
test_func = dct[test]
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894530
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: I19bdf4a7db13996a93cfbd8fbe5ad817931ab97c
Gerrit-Change-Number: 894530
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
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/+/894208 )
Change subject: [bugfix] load page info when creating a page if not updated previously
......................................................................
[bugfix] load page info when creating a page if not updated previously
If pageid was retrieved and the page was created after that,
the new pageid is not updated and remains 0. Therefore call
site.loadpageinfo in such case.
Bug: T330980
Change-Id: I6a867da59dda24e0387db556edda85a92d570cca
---
M pywikibot/page/_basepage.py
1 file changed, 18 insertions(+), 0 deletions(-)
Approvals:
Bináris: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 2dc891a..8a7374e 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -1291,6 +1291,10 @@
if not quiet:
pywikibot.warning(f'Page {link} not saved')
raise PageSaveRelatedError(self)
+
+ if not self.pageid:
+ self.site.loadpageinfo(self)
+
if not quiet:
pywikibot.info(f'Page {link} saved')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894208
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: I6a867da59dda24e0387db556edda85a92d570cca
Gerrit-Change-Number: 894208
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
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/+/894206 )
Change subject: [tests] Skip test on proofwiki on github action
......................................................................
[tests] Skip test on proofwiki on github action
Access to proofwiki is forbidden (status 403) if called from
github action. Skip this test then instead of expect the failure.
Bug: T331223
Change-Id: Ice47cf3ae7883bfa4012e7b8fea4b7a2008d9dd7
---
M tests/site_detect_tests.py
1 file changed, 16 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 918d76f..6173ff7 100755
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -18,7 +18,7 @@
from pywikibot.site_detect import MWSite
from tests.aspects import PatchingTestCase, TestCase
-from tests.utils import DrySite, expected_failure_if, skipping
+from tests.utils import DrySite, skipping
class SiteDetectionTestCase(TestCase):
@@ -58,7 +58,6 @@
"""Test detection of MediaWiki sites."""
standard_version_sites = (
- # 'http://www.proofwiki.org/wiki/$1',
'http://www.ck-wissen.de/ckwiki/index.php?title=$1',
'http://en.citizendium.org/wiki/$1',
# Server that hosts www.wikichristian.org is unreliable - it
@@ -113,10 +112,10 @@
with self.subTest(url=urlparse(url).netloc):
self.assertSite(url)
- @expected_failure_if(os.getenv('GITHUB_ACTIONS')) # T331223
def test_proofreadwiki(self):
"""Test detection of proofwiki.org site."""
- # test is failing on github, see T331223
+ if os.getenv('GITHUB_ACTIONS'):
+ self.skipTest('Skip test on github due to T331223')
self.assertSite('http://www.proofwiki.org/wiki/$1')
def test_non_standard_version_sites(self):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894206
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: Ice47cf3ae7883bfa4012e7b8fea4b7a2008d9dd7
Gerrit-Change-Number: 894206
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged