Dalba added a comment.

The relation between the old cmstartsortkey and the new cmstarthexsortkey is as follows:

(I'm using Python 3 here)

import binascii
cmstarthexsortkey = '26589262ff277e03042692ff274d217e032627017e88010e'
cmstartsortkey = binascii.unhexlify(cmstarthexsortkey ).decode('utf-8', 'ignore')

These are the sort keys for the article "چرخه رنگ‌ها" on fawiki. cmstartsortkey is the actual value stored in the database. Look at the cl_sortkey field in the categorylinks table.

To convert the old cmstartsortkey values to cmstarthexsortkey:

cmstartsortkey = "&Xb'~\x03\x04&'M!~\x03&'\x01~\x01\x0e"
binascii.hexlify(cmstartsortkey .encode()) == cmstarthexsortkey

Actually, we probably don't need any of these conversions. Both cmstartsortkey and cmstarthexsortkey are values that are usually obtained via the API. The old API used to both give and take cmstartsortkey and the new API uses cmstarthexsortkey. All we have to do is to change the old cmstartsortkey to cmstarthexsortkey for mw1.24+ and hopefully the users won't notice anything.

If we want a human readable way of setting the start value for the categorymembers method, we probably have to add to new arguments and pass them to API as cmstartsortkeyprefix and cmendsortkeyprefix.


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

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

To: Xqt, Dalba
Cc: Dalba, gerritbot, Aklapper, Andre_Engels, StudiesWorld, Xqt, jayvdb, XZise, Multichill, Ricordisamoa, pywikibot-bugs-list, Mpaa, Lewizho99, Mdupont, JJMC89, Maathavan, Anshoe
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to