jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/959947 )
Change subject: [doc] Center branding text in sidebar
......................................................................
[doc] Center branding text in sidebar
Most recent documentation builds no longer center the text in the
sidebar. Instead, it's aligned to the left. This is probably due
to changes in Sphinx 6.0.0 that broke a variable Furo relies on
to center that text. I was not able to pinpoint the root cause so
I'm proposing custom CSS as a workaround. Tested with Sphinx 7.2.3
and Furo 2023.09.10.
Change-Id: Ib33c97355cfe2b696d72c5520bcd69a2c691bfec
---
M docs/_static/css/pywikibot.css
1 file changed, 21 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/_static/css/pywikibot.css b/docs/_static/css/pywikibot.css
index b03fa36..80e0450 100644
--- a/docs/_static/css/pywikibot.css
+++ b/docs/_static/css/pywikibot.css
@@ -5,6 +5,11 @@
max-width: 75%;
}
+/** centering sidebar branding text as a workaround **/
+.sidebar-brand {
+ text-align: center;
+}
+
/** brand text in the sidebar smaller than default **/
.sidebar-brand-text {
font-size: 1rem;
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/959947
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: Ib33c97355cfe2b696d72c5520bcd69a2c691bfec
Gerrit-Change-Number: 959947
Gerrit-PatchSet: 1
Gerrit-Owner: KBach <kbach(a)wikimedia.org>
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/+/959331 )
Change subject: [bugfix] upcast to FilePage for a proper extension only
......................................................................
[bugfix] upcast to FilePage for a proper extension only
- also raise ValueError if no file extension is given
- update pagegenerators_tests TestWantedFactoryGenerator accordingly
and take into account that generator yields a Page instead of a
FilePage.
Bug: T346889
Change-Id: I4f6b52b456655a64bed54780b973d552b7a9eeda
---
M pywikibot/page/_filepage.py
M tests/pagegenerators_tests.py
M pywikibot/data/api/_generators.py
3 files changed, 27 insertions(+), 5 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_generators.py b/pywikibot/data/api/_generators.py
index 3090ef3..e483ef3 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -11,6 +11,7 @@
# Distributed under the terms of the MIT license.
#
from abc import ABC, abstractmethod
+from contextlib import suppress
from typing import Union
from warnings import warn
@@ -719,7 +720,8 @@
if ns == 2:
p = pywikibot.User(p)
elif ns == 6:
- p = pywikibot.FilePage(p)
+ with suppress(ValueError):
+ p = pywikibot.FilePage(p)
elif ns == 14:
p = pywikibot.Category(p)
update_page(p, pagedata, self.props)
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 4cb91fe..f9347ad 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -55,9 +55,10 @@
super().__init__(source, title, 6)
if self.namespace() != 6:
raise ValueError(f"'{self.title()}' is not in the file namespace!")
- title = self.title(with_section=False)
- extension = title.rpartition('.')[2].lower()
- if extension not in self.site.file_extensions:
+
+ title = self.title(with_ns=False, with_section=False)
+ _, sep, extension = title.rpartition('.')
+ if not sep or extension.lower() not in self.site.file_extensions:
raise ValueError(
f'{title!r} does not have a valid extension '
f'({", ".join(self.site.file_extensions)}).'
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 607617b..f6b90b6 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1435,7 +1435,11 @@
"""Test wantedfiles generator."""
self.gf.handle_arg('-wantedfiles:5')
for page in self._generator_with_tests():
- self.assertIsInstance(page, pywikibot.FilePage)
+ self.assertIsInstance(page, pywikibot.Page)
+ if not isinstance(page, pywikibot.FilePage):
+ with self.assertRaisesRegex(ValueError,
+ 'does not have a valid extension'):
+ pywikibot.FilePage(page)
def test_wanted_templates(self):
"""Test wantedtemplates generator."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/959331
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: I4f6b52b456655a64bed54780b973d552b7a9eeda
Gerrit-Change-Number: 959331
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged