jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1155279?usp=email )

Change subject: cleanup: deprecate Family.categories_last attribute
......................................................................

cleanup: deprecate Family.categories_last attribute

Use site.has_extension('CategorySelect') instead

Bug: T86284
Change-Id: Id12ff75d5d1474db0059c8cb2761a42b75ef2a3a
---
M pywikibot/families/wowwiki_family.py
M pywikibot/family.py
M pywikibot/textlib.py
3 files changed, 24 insertions(+), 15 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/families/wowwiki_family.py 
b/pywikibot/families/wowwiki_family.py
index dcf9767..bdc5918 100644
--- a/pywikibot/families/wowwiki_family.py
+++ b/pywikibot/families/wowwiki_family.py
@@ -1,13 +1,13 @@
 """Family module for WOW wiki."""
 #
-# (C) Pywikibot team, 2009-2024
+# (C) Pywikibot team, 2009-2025
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import annotations

 from pywikibot import family
-from pywikibot.tools import classproperty
+from pywikibot.tools import classproperty, deprecated


 class Family(family.FandomFamily):
@@ -52,10 +52,16 @@
         cls.disambcatname['en'] = 'Disambiguations'
         return cls.disambcatname

-    # Wikia's default CategorySelect extension always puts categories last
+    # Wikia's default SelectCategory extension always puts categories last
     @classproperty
+    @deprecated('site.has_extension("CategorySelect")', since='10.3.0')
     def categories_last(cls):
-        """Property listing site keys for categories at last position."""
+        """Property listing site keys for categories at last position.
+
+        .. deprecated:: 10.3
+           use :meth:`site.has_extension('CategorySelect')
+           <pywikibot.site._apisite.APISite.has_extension>` instead
+        """
         return cls.langs.keys()

     @classproperty
diff --git a/pywikibot/family.py b/pywikibot/family.py
index f1b3a26..d3534d6 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -181,14 +181,6 @@
     #: String used as separator between category links and the text
     category_text_separator = '\n\n'

-    categories_last: list[str] = []
-    """When both at the bottom should categories come after interwikilinks?
-
-    TODO: :phab:`T86284` Needed on Wikia sites, as it uses the
-    CategorySelect extension which puts categories last on all sites.
-    TO BE DEPRECATED!
-    """
-
     interwiki_putfirst: dict[str, str] = {}
     """Which languages have a special order for putting interlanguage links,
     and what order is it?
@@ -329,6 +321,17 @@

     _families: dict[str, Family] = {}

+    @classproperty
+    @deprecated('site.has_extension("CategorySelect")', since='10.3.0')
+    def categories_last(cls) -> list[str]:
+        """Categories come after interwiki links for the given site codes.
+
+        .. deprecated:: 10.3
+           use :meth:`site.has_extension('CategorySelect')
+           <pywikibot.site._apisite.APISite.has_extension>` instead
+        """
+        return []
+
     @staticmethod
     def load(fam: str | None = None):
         """Import the named family.
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 75774bf..257e1a7 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1,6 +1,6 @@
 """Functions for manipulating wiki-text."""
 #
-# (C) Pywikibot team, 2008-2024
+# (C) Pywikibot team, 2008-2025
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1323,7 +1323,7 @@
                 s = separator + s
             newtext = (s2[:firstafter].replace(marker, '')
                        + s + s2[firstafter:])
-        elif site.code in site.family.categories_last:
+        elif site.has_extension('CategorySelect'):
             cats = getCategoryLinks(s2, site=site)
             s2 = removeCategoryLinksAndSeparator(
                 s2.replace(marker, cseparatorstripped).strip(), site) \
@@ -1650,7 +1650,7 @@
                 new_cats = separator + new_cats
             newtext = (cats_removed_text[:firstafter].replace(marker, '')
                        + new_cats + cats_removed_text[firstafter:])
-        elif site.code in site.family.categories_last:
+        elif site.has_extension('CategorySelect'):
             newtext = (cats_removed_text.replace(marker, '').strip()
                        + separator + new_cats)
         else:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1155279?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id12ff75d5d1474db0059c8cb2761a42b75ef2a3a
Gerrit-Change-Number: 1155279
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to