I've noticed something a little strange about the "editable" key that the mobileview API returns. It seems it's either "true" or the empty string if the page is editable, or either "false" or absent from the response if the page is not editable. Whether it goes for the empty string/absent or true/false approach seems to vary from wiki to wiki.
Examples (make sure you're not logged in on an admin account when you click these, because admin accounts can edit almost all pages):
- Foo @ testwiki https://test.wikipedia.org/w/api.php?action=mobileview&page=Foo&prop=editable - response is the empty string on an editable page - Protected page @ testwiki https://test.wikipedia.org/w/api.php?action=mobileview&page=Protected_page&prop=editable - response is absent on a protected page - Manchester @ enwiki https://en.wikipedia.org/w/api.php?action=mobileview&page=Manchester&prop=editable - response is true on an editable page - Barack Obama @ enwiki https://en.wikipedia.org/w/api.php?action=mobileview&page=Barack%20Obama&prop=editable - response is false on a protected page
Does anyone know why this is? It'd be nice if this could be changed, because it's a pain to deal with things like this in a strongly-typed language like Java.
Thanks, Dan
+ anomie he might have ideas. On 28 Apr 2015 5:32 pm, "Dan Garry" dgarry@wikimedia.org wrote:
I've noticed something a little strange about the "editable" key that the mobileview API returns. It seems it's either "true" or the empty string if the page is editable, or either "false" or absent from the response if the page is not editable. Whether it goes for the empty string/absent or true/false approach seems to vary from wiki to wiki.
Examples (make sure you're not logged in on an admin account when you click these, because admin accounts can edit almost all pages):
- Foo @ testwiki
https://test.wikipedia.org/w/api.php?action=mobileview&page=Foo&prop=editable - response is the empty string on an editable page
- Protected page @ testwiki
https://test.wikipedia.org/w/api.php?action=mobileview&page=Protected_page&prop=editable - response is absent on a protected page
- Manchester @ enwiki
https://en.wikipedia.org/w/api.php?action=mobileview&page=Manchester&prop=editable - response is true on an editable page
- Barack Obama @ enwiki
https://en.wikipedia.org/w/api.php?action=mobileview&page=Barack%20Obama&prop=editable - response is false on a protected page
Does anyone know why this is? It'd be nice if this could be changed, because it's a pain to deal with things like this in a strongly-typed language like Java.
Thanks, Dan
-- Dan Garry Product Manager, Search and Discovery Wikimedia Foundation
Mobile-l mailing list Mobile-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mobile-l
On 04/28/2015 05:31 PM, Dan Garry wrote:
I've noticed something a little strange about the "editable" key that the mobileview API returns. It seems it's either "true" or the empty string if the page is editable, or either "false" or absent from the response if the page is not editable. Whether it goes for the empty string/absent or true/false approach seems to vary from wiki to wiki.
The mobileview API was outputting a raw "true" or "false" boolean, against the previous API standards which was to add the key with empty string for true, and omit for false. The new API code present in 1.26wmf3 (on group0+1 wikis, hits group2 tomorrow) automatically converts raw booleans to the previous format so developers can easily transition to formatversion=2 which handles all of this in a sane manner. It's a trivial fix, I'll submit a patch momentarily, which should likely be backported.
Does anyone know why this is? It'd be nice if this could be changed, because it's a pain to deal with things like this in a strongly-typed language like Java.
Changed to what? I think it would be a pain to deal with in any language ;-)
-- Legoktm
On 04/28/2015 06:51 PM, Legoktm wrote:
I'll submit a patch momentarily, which should likely be backported.
https://gerrit.wikimedia.org/r/207358
-- Legoktm
Hey Kunal,
Thanks for the fix! My responses are in-line.
On 28 April 2015 at 18:51, Legoktm legoktm.wikipedia@gmail.com wrote:
It's a trivial fix, I'll submit a patch momentarily, which should likely be backported.
Please do backport this! Otherwise when this goes live tomorrow every page in the mobile app will erroneously show as protected. :-(
Changed to what? I think it would be a pain to deal with in any language ;-)
Changed to either return true or false. But you did that for me, so thank you. :-)
Dan