XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/161676

Change subject: [FIX] Only apply uppercase to Link title if namespace dictates 
so
......................................................................

[FIX] Only apply uppercase to Link title if namespace dictates so

The namespace defines if a Link title begins with an uppercase character.
The main namespace of Wiktionary, for example requires an exact match. As
the namespace always define the case, using the site case isn't necessary.

Also the item and property namespace on the don't report the 'case'
property but Wikidata handles it like 'first-letter'.

Bug: 69118 (partially)
Change-Id: If86346dc203c54d2e6631e3dddd106add3c34d30
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/76/161676/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 13a5010..fefafb8 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4118,7 +4118,7 @@
         if self._namespace != -1 and len(t) > 255:
             raise pywikibot.InvalidTitle("(over 255 bytes): '%s'" % t)
 
-        if self._site.case() == 'first-letter':
+        if self._site.namespaces()[self._namespace].case == 'first-letter':
             t = t[:1].upper() + t[1:]
 
         # Can't make a link to a namespace alone...
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 82a7299..a724449 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -244,6 +244,11 @@
         else:
             self.aliases = aliases
 
+        # The wikibase item/property namespace don't have a case attribute
+        if (kwargs.get('defaultcontentmodel') in [
+                'wikibase-item', 'wikibase-property']):
+            self.case = 'first-letter'
+
         for key, value in kwargs.items():
             setattr(self, key, value)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/161676
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If86346dc203c54d2e6631e3dddd106add3c34d30
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to