Multichill added a comment.

Item:
*https://www.wikidata.org/w/api.php?action="">

Property:

FilePage:
*
https://www.wikidata.org/w/api.php?action="">

Coordinate:

https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/__init__.py;b6e933d4e33e1035457755015b29da74b8c8160a$304

Etc, all the output we get seem and should match the constructors we have for the objects.

This only makes sense for data types that are subclasses of WbRepresentation
https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/_wbtypes.py%3Bb6e933d4e33e1035457755015b29da74b8c8160a . These classes all have a fromWikibase function.

So the logic should probably be:

  • DataSite.parsevalue(datatype, value, options, validate)
  • Check that datatype is the name of a subclass of " WbRepresentation"
  • Throw it to the server
  • If the result is ok, return <subclass we found>.fromWikibase(<the json>)

Something like that?

This way, if a new datatype gets added, this part of the code doesn't need to change.


TASK DETAIL
https://phabricator.wikimedia.org/T112140

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: ArthurPSmith, Multichill
Cc: Tobias1984, ArthurPSmith, Aklapper, pywikibot-bugs-list, Multichill, Mdupont, D3r1ck01, Izno, Wikidata-bugs, aude, jayvdb, Ricordisamoa, Mbch331
_______________________________________________
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to