XZise created this task.
XZise added subscribers: XZise, Xqt.
XZise added a project: pywikibot-core.
Restricted Application added subscribers: Aklapper, pywikipedia-bugs.

TASK DESCRIPTION
  There are currently some methods in `BaseSite` which return the custom 
namespace name for certain (usually special) namespaces added before the 
`Namespace` class was added. There should be a way to get them without relying 
to know the namespace id's themselves. There are currently `special_namespace`, 
`image_namespace`, `mediawiki_namespace`, `template_namespace`, 
`category_namespace` and `category_namespaces`. Those should be deprecated and 
replaced by a more usable system which should also incorporate 
`BasePage.isImage` and `BasePage.isCategory`.
  
  One suggestion is to have, similar to how PHP does it, constants like 
`NS_CATEGORY` which contain the namespace number and via 
`BaseSite.namespaces[BaseSite.NS_CATEGORY]` it would be possible to get the 
actual `Namespace` object. This would rely on the presumption that the 
namespace ids will never change (or the changes are so drastic that it must be 
redesigned anyway).
  
  A more future proof solution would be to add other methods which are like the 
current ones but just return the `Namespace` object. In fact it might be 
possible to do that already as it behaves similar to the string which is 
returned already.
  
  Especially another problem regarding the `Page`'s methods is that those don't 
necessarily mean that the page is a `FilePage` or `Category`[Page]. So it can't 
be substituted by an `isinstance` call but it could either compare the 
namespace to a constant like `NS_CATEGORY` (and minimize the number of magic 
numbers) or use the `Namespace` object returned by the new function.

TASK DETAIL
  https://phabricator.wikimedia.org/T87543

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: XZise
Cc: Xqt, Aklapper, XZise, jayvdb, pywikipedia-bugs



_______________________________________________
Pywikipedia-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-bugs

Reply via email to