simetrical@svn.wikimedia.org schreef:
Revision: 32179 Author: simetrical Date: 2008-03-19 15:53:48 +0000 (Wed, 19 Mar 2008)
Log Message:
Fix an error for categories named literally "Project:" or some similarly weird thing. I thought that's not a legal title, but I'm told otherwise. Is there a better way to do this than manually prefixing "Category:"? The second parameter to newFromText is ignored if there are any prefixes, according to the docs.
You could try Title::newFromText(":$foo", NS_CATEGORY); , which uses the category namespace as the default mainspace, which is then forced by the leading colon. I haven't tested this and I'm not 100% sure this works, but you could try (it'd still be hackish, but it'd be cleaner than the alternative).
Roan Kattouw (Catrope)
Roan Kattouw wrote:
simetrical@svn.wikimedia.org schreef:
Revision: 32179 Author: simetrical Date: 2008-03-19 15:53:48 +0000 (Wed, 19 Mar 2008)
Log Message:
Fix an error for categories named literally "Project:" or some similarly weird thing. I thought that's not a legal title, but I'm told otherwise. Is there a better way to do this than manually prefixing "Category:"? The second parameter to newFromText is ignored if there are any prefixes, according to the docs.
You could try Title::newFromText(":$foo", NS_CATEGORY); , which uses the category namespace as the default mainspace, which is then forced by the leading colon. I haven't tested this and I'm not 100% sure this works, but you could try (it'd still be hackish, but it'd be cleaner than the alternative).
Roan Kattouw (Catrope)
Yeah, I've already replaced it with Title::makeTitleSafe(). And I still can't understand why did Simetrical reverted r32229. --VasilievVV
On Tue, Mar 25, 2008 at 12:18 AM, VasilievVV vasilvv@gmail.com wrote:
Yeah, I've already replaced it with Title::makeTitleSafe(). And I still can't understand why did Simetrical reverted r32229.
The documentation for Title::makeTitleSafe() says it accepts title keys only. r32229 added it in a place that was supposed to accept text forms, not just title keys.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Simetrical wrote:
On Tue, Mar 25, 2008 at 12:18 AM, VasilievVV vasilvv@gmail.com wrote:
Yeah, I've already replaced it with Title::makeTitleSafe(). And I still can't understand why did Simetrical reverted r32229.
The documentation for Title::makeTitleSafe() says it accepts title keys only. r32229 added it in a place that was supposed to accept text forms, not just title keys.
These days pretty much everything should be accepting either spaces or underscores and normalizing input to the appropriate internal processing form.
If there are exceptions (and I'm sure there are), they ought to get fixed. :)
Title::makeTitle and Title::makeTitleSafe certainly will accept spaces; historically it was too error-prone to maintain a forced underscores-only input regimen.
- -- brion vibber (brion @ wikimedia.org)
wikitech-l@lists.wikimedia.org