Last modified: 2014-04-15 16:27:57 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 T49601, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47601 - Accept mw.title object as the title argument of frame:expandTemplate()
Accept mw.title object as the title argument of frame:expandTemplate()
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-24 09:25 UTC by Liangent
Modified: 2014-04-15 16:27 UTC (History)
3 users (show)

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


Attachments

Description Liangent 2013-04-24 09:25:59 UTC
It even makes more sense to accept a title object than a string.
Comment 1 Brad Jorsch 2013-04-24 14:47:24 UTC
frame:expandTemplate doesn't validate the type of its argument, and just calls tostring() on it. Since tostring( titleObj ) returns the page title, frame:expandTemplate already does accept a title object.

The only caveat is that you can't pass in a namespace-0 title object in this way, since it will be stringified without a leading colon so then frame:expandTemplate will look for it in the Template namespace instead of namespace 0.
Comment 2 Liangent 2013-04-24 14:50:55 UTC
(In reply to comment #1)
> The only caveat is that you can't pass in a namespace-0 title object in this
> way, since it will be stringified without a leading colon so then
> frame:expandTemplate will look for it in the Template namespace instead of
> namespace 0.

This is the reason I filed this bug.
Comment 3 Brad Jorsch 2013-04-24 14:57:02 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > The only caveat is that you can't pass in a namespace-0 title object in this
> > way, since it will be stringified without a leading colon so then
> > frame:expandTemplate will look for it in the Template namespace instead of
> > namespace 0.
> 
> This is the reason I filed this bug.

You should have stated that in your original description.


This should be easy enough with the same sort of check used in mw.message's title() method, just prepend the necessary colon if the passed value is a table with .namespace == 0.
Comment 4 Gerrit Notification Bot 2014-04-10 15:33:01 UTC
Change 125207 had a related patch set uploaded by Happy5214:
Accept mw.title object as the title argument of frame:expandTemplate()

https://gerrit.wikimedia.org/r/125207
Comment 5 Gerrit Notification Bot 2014-04-15 16:11:28 UTC
Change 125207 merged by jenkins-bot:
Accept mw.title object as the title argument of frame:expandTemplate()

https://gerrit.wikimedia.org/r/125207
Comment 6 Brad Jorsch 2014-04-15 16:27:57 UTC
The change should be deployed to WMF wikis with 1.24wmf1, see https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.

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


Navigation
Links