Page MenuHomePhabricator

Update BaseSite.urlEncode and create tests
Closed, ResolvedPublic


The method BaseSite.urlEncode from Pywikibot-compat was copied to Pywikibot as deprecated, and core uses urlencode as its implementation.

In the compat , BaseSite.urlEncode moved wpEditToken to the last arg as recommended by the API documentation, and it did utf8 encoding.

POST parameter encoding in core is now performed mostly in This class does encoding properly, but does not re-order the parameters. To fix this, any parameter named '*token' should be moved to the end.

The deprecated BaseSite.urlEncode in core also needs to be updated so it is backwards compatible.

Tests need to be created to verify that and BaseSite.urlEncode re-order parameters, and very basic tests are needed to verify that BaseSite.urlEncode encodes the parameters correctly.

Mentor: @jayvdb
Difficulty: Medium

Event Timeline

jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb added subscribers: Unknown Object (MLST), jayvdb.
XZise set Security to None.
XZise added a subscriber: XZise.

I'm not sure, but applying UTF8 encoding on a url-encoded string?

Aklapper renamed this task from BaseSite.urlEncode to Update BaseSite.urlEncode and create tests.Dec 1 2015, 2:41 PM

Change 258433 had a related patch set uploaded (by Murfel):
Add encode_url to

Change 258433 merged by jenkins-bot:
Add encode_url to

Change 258683 had a related patch set uploaded (by John Vandenberg):
Fix encode_url dict support on Python 3

Change 258683 merged by jenkins-bot:
Fix encode_url dict support on Python 3