jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756154 )
Change subject: [tests] change url for ecoreality.org tests
......................................................................
[tests] change url for ecoreality.org tests
Bug: T299852
Change-Id: I741f101975b4ef41c65c4264f776f49aabe4837f
---
M tests/site_detect_tests.py
1 file changed, 2 insertions(+), 2 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 b675b51..8015f66 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -120,7 +120,7 @@
api.php is not available. Anyway the wiki is outdated.
"""
- self.assertNoSite('http://www.ecoreality.org/wiki/$1') # v1.16.2
+ self.assertNoSite('http://ecoreality.org/wiki/$1') # v1.16.2
class PreAPISiteTestCase(SiteDetectionTestCase):
@@ -162,7 +162,7 @@
api.php is not available. HTML looks like it has an API, but redirect
rules prevent access.
"""
- self.assertNoSite('http://www.EcoReality.org/wiki/$1')
+ self.assertNoSite('http://EcoReality.org/wiki/$1')
class FailingSiteTestCase(SiteDetectionTestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756154
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: I741f101975b4ef41c65c4264f776f49aabe4837f
Gerrit-Change-Number: 756154
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756061 )
Change subject: [bugfix] Allow categories when saving IndexPage
......................................................................
[bugfix] Allow categories when saving IndexPage
It is possible to have categories in IndexPage.
Take them into consideration when validating page content,
otherwise it will not be possible to save the page.
Bug: T299806
Change-Id: I58c0370a938958d7f2800b7b099992526db0d0df
---
M pywikibot/proofreadpage.py
1 file changed, 12 insertions(+), 4 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 7096f32..8fca578 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -860,13 +860,21 @@
def has_valid_content(self) -> bool:
"""Test page only contains a single call to the index template."""
- if (not self.text.startswith('{{' + self.INDEX_TEMPLATE)
- or not self.text.endswith('}}')):
+ text = self.text
+
+ if not text.startswith('{{' + self.INDEX_TEMPLATE):
+ return False
+
+ # Discard possible categories after INDEX_TEMPLATE
+ categories = textlib.getCategoryLinks(text, self.site)
+ for cat in categories:
+ text = text.replace('\n' + cat.title(as_link=True), '')
+
+ if not text.endswith('}}'):
return False
# Discard all inner templates as only top-level ones matter
- templates = textlib.extract_templates_and_params_regex_simple(
- self.text)
+ templates = textlib.extract_templates_and_params_regex_simple(text)
if len(templates) != 1 or templates[0][0] != self.INDEX_TEMPLATE:
# Only a single call to the INDEX_TEMPLATE is allowed
return False
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756061
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: I58c0370a938958d7f2800b7b099992526db0d0df
Gerrit-Change-Number: 756061
Gerrit-PatchSet: 2
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756024 )
Change subject: [IMPR] Simplify int assignment
......................................................................
[IMPR] Simplify int assignment
Change-Id: I6e8d2486d40266b5f5f2998c8815f19ecf409e77
---
M scripts/archive/wikisourcetext.py
M scripts/djvutext.py
2 files changed, 6 insertions(+), 12 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
Xqt: Verified; Looks good to me, approved
diff --git a/scripts/archive/wikisourcetext.py b/scripts/archive/wikisourcetext.py
index 6604c31..835b460 100755
--- a/scripts/archive/wikisourcetext.py
+++ b/scripts/archive/wikisourcetext.py
@@ -53,7 +53,7 @@
-always don't bother asking to confirm any of the changes.
"""
#
-# (C) Pywikibot team, 2016-2021
+# (C) Pywikibot team, 2016-2022
#
# Distributed under the terms of the MIT license.
#
@@ -252,11 +252,8 @@
pages = pages.split(',')
for interval in range(len(pages)):
start, sep, end = pages[interval].partition('-')
- start = 1 if not start else int(start)
- if not sep:
- end = start
- else:
- end = int(end) if end else index.num_pages
+ start = int(start or 1)
+ end = int(end or index.num_pages) if sep else start
pages[interval] = (start, end)
# gen yields ProofreadPage objects.
diff --git a/scripts/djvutext.py b/scripts/djvutext.py
index 5c65787..638ea06 100755
--- a/scripts/djvutext.py
+++ b/scripts/djvutext.py
@@ -32,7 +32,7 @@
"""
#
-# (C) Pywikibot team, 2008-2021
+# (C) Pywikibot team, 2008-2022
#
# Distributed under the terms of the MIT license.
#
@@ -182,11 +182,8 @@
pages = pages.split(',')
for i, page_interval in enumerate(pages):
start, sep, end = page_interval.partition('-')
- start = 1 if not start else int(start)
- if not sep:
- end = start
- else:
- end = int(end) if end else djvu.number_of_images()
+ start = int(start or 1)
+ end = int(end or djvu.number_of_images()) if sep else start
pages[i] = (start, end)
site = pywikibot.Site()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/756024
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: I6e8d2486d40266b5f5f2998c8815f19ecf409e77
Gerrit-Change-Number: 756024
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged