Page MenuHomePhabricator

Name of excluded-in-print category cannot start with a namespace name
Closed, DeclinedPublic

Description

The name of the template exclusion category, specified in [[MediaWiki:coll-exclusion_category_title]], cannot start with something resembling a namespace name. E.g. the category cannot be named [[Category:Project:Excluded in print]], since “Project:” seems like a namespace prefix.

The problem is that Collection passes the name (template_exclusion_category) without the “Category:” prefix, while mwlib parses the given name with “Category:” being _only the default_ (i.e. if the name does not specify a namespace, assume Category, otherwise use the specified namespace – see nshandler.splitname used in fetch.py).

The problem might be worked around by specifying the full name of the category (i.e. set [[MediaWiki:coll-exclusion_category_title]] to “Category:Project:Excluded in print” instead of just “Project:Excluded in print”), but in that case, you also need to tweak [[MediaWiki:Coll-excluded-templates]], so that it does not add a second “Category:” prefix.

Anyway, the proper solution would be to either change mwlib so that the Category NS is not just a default, but is used always, or fix Collection.body.php to set template_exclusion_category to the full name of the category (including the “Category:” prefix) when passing it to MWServe.


Version: unspecified
Severity: minor

Details

Reference
bz20616

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:48 PM
bzimport added a project: Collection.
bzimport set Reference to bz20616.

ralf_wikimedia wrote:

Thanks for your detailed explanation. Since specifying the full name including the Category: prefix works, we won't fix that. IMHO, the software just does, what it's told to do.

(In reply to comment #1)

Since specifying the full name including
the Category: prefix works, we won't fix that.

The workaround is not a perfect solution. For one thing, in the [[MediaWiki:Coll-excluded-templates]] message, you cannot get rid of the “Category:” prefix. The default displays “Templates in category Exclude in print have been excluded.” When working around the bug, you will receive “Templates in category Category:Exclude in print have been excluded.” (you can remove the word “category”, but not the “Category:” prefix).

IMHO, the software just does, what it's told to do.

Well, no, not really. When you set [[MediaWiki:coll-exclusion_category_title]] to e.g. “Project Nonprintable”, it works and templates within [[Category:Project Nonprintable]] are excluded. When you change it so slightly to “Project:Nonprintable”, it does not work and _no_ templates are excluded. It requires digging in the code to learn why all templates are printed, and learn how you could change two messages to make it work. (This is how I discovered the problem – templates kept being rendered on the Czech Wikipedia, ignoring the nonprintable template category. Nobody knew what the problem was until I analyzed the code and discovered that our choice of the name for the exclusion category was troublesome.)

The behaviour described seems really non-intuitive for something that's working as intended...

fix
Collection.body.php to set template_exclusion_category to the full name of the
category (including the “Category:” prefix) when passing it to MWServe

imho that seems logical.