Page MenuHomePhabricator

TemplateData: "sets" don't come through in api when td is in a transcluded page
Closed, ResolvedPublic

Description

When the td is transcluded, the api returns an empty array for "sets".

"sets" are getting eaten on transclusion. i.e. in the api they appear in, for instance, api.php?action=templatedata&titles=Template:Cite_journal/doc, but NOT in api.php?action=templatedata&titles=Template:Cite_journal, when the sets field is set in <templatedata> tags.


Version: unspecified
Severity: normal

Details

Reference
bz69647

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:36 AM
bzimport added a project: TemplateData.
bzimport set Reference to bz69647.

Additional info:

  1. Sets are not currently being used, as far as I know.
  1. So in order to test this, you'll have to add (on localhost) the set parameter. For instance, in my <templdatedata> I have:

"sets": [

		{
			"label": "SomeIDs",
			"params": ["id", "rfc"]
		}

],

  1. And then in the api, on Cite_journal/doc I get back:

    "sets": [ { "label": { "en-gb": "SomeIDs" }, "params": [ "id", "rfc" ] } ],
  1. But in the api, on Cite_journal, I get back:

    "sets": []

Which is an empty array that is appended to what is returned from the api, since what the is retrieved from the database does not contain the sets parameter.

I tested this on my local wiki by adding sets: [] to a local template. I was able to get the full information (with the sets I filled in) in the API response.

If this was tested in production, I wonder if it may have been a case of delay between updating some cache the API is using?

Am I misunderstanding the problem?

Can't reproduce this on latest master.

Edited Unsigned/doc on my local wiki and added a sets section:

"sets": [

		{
			"label": {
				"en": "Default",
				"nl": "Standaard"
			},
			"params": [
				"user",
				"timestamp"
			]
		}

]

  • w/api.php?format=jsonfm&action=templatedata&titles=Template:Unsigned/doc
  • w/api.php?format=jsonfm&action=templatedata&titles=Template:Unsigned

Both included the new "sets" data.

Thanks for looking into this all.

I just realized this is actually a duplicate bug:

https://bugzilla.wikimedia.org/show_bug.cgi?id=50372

Basically the templatedata property in pp page gets updated when I save changes to cite_web/doc, but not cite_web, so when I made api requests I was getting old td from cite_web and the new changes to cite_web/doc. I can force the change by making a blank edit to the place where td is transcluded i.e. directly in Template:cite_web.

The fact that what I was editing was "sets" at the time was a red herring, so thanks for disabusing me of the notion this was a "sets" issue!

  • This bug has been marked as a duplicate of bug 50372 ***