Last modified: 2014-09-04 15:22:32 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57014, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55014 - Let bots use canonical namespaces
Let bots use canonical namespaces
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
compat-(1.0)
All All
: Unprioritized enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:04 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-04 15:22 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:04:20 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/feature-requests/332/
Reported by: pathoschild
Created on: 2013-02-23 02:45:38
Subject: Let bots use canonical namespaces
Original description:
Let bots use canonical namespaces instead of translations from the family files. This is useful for crosswiki bots, where invalid namespace names may not be detected by the operator \(most recently \[1\]\[2\]\).

The attached patch implements this by adding an optional constructor argument to Page. For example, the current behaviour is unchanged:
ns = wikipedia.Page\(site, title\).namespaceName\(\) \# Utilisateur:Pathoschild
But a constructor argument enables canonical namespaces:
ns = wikipedia.Page\(site, title, translateNamespace=False\).namespaceName\(\) \# User:Pathoschild

\[1\] http://meta.wikimedia.org/wiki/User\_talk:Pathoschild?oldid=5269904\#Probl.C3.A8me\_avec\_ton\_bot\_sur\_Wikinews\_portugais
\[2\] http://meta.wikimedia.org/wiki/User\_talk:Pathoschild?oldid=5269904\#Polish\_Wikivoyage\_user\_js\_files
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:04:22 UTC
Patch which enables canonical namespace support.
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:04:24 UTC
- **labels**: 3222924 -->
Comment 3 John Mark Vandenberg 2014-08-21 02:27:01 UTC
The patch is against compat, but core has the same problem.

Core now has a Namespace class, which captures the canonical namespaces data of the wiki.  Relevant code at:
https://git.wikimedia.org/blob/pywikibot%2Fcore.git/9b67ec1424d160d1968ef3f3da9f179675d68070/pywikibot%2Fsite.py#L131
https://git.wikimedia.org/blob/pywikibot%2Fcore.git/9b67ec1424d160d1968ef3f3da9f179675d68070/pywikibot%2Fsite.py#L577

The Namespace class isnt utilised in the old link parsing algorithms.  There are a few core changesets related to this problem:
https://gerrit.wikimedia.org/r/#/c/150872/ - Link normalization
https://gerrit.wikimedia.org/r/#/c/148337/ - force using namespace param; ignore namespace in title

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links