jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/404907 )
Change subject: BasePage.title: Encode slashes when asUrl is True ......................................................................
BasePage.title: Encode slashes when asUrl is True
Update page_tests.TestPermalink.test_permalink accordingly.
Bug: T184712 Change-Id: Ib19e3004761dd29adab762ff3f5a9ec0c1a5d3ba --- M pywikibot/page.py M tests/page_tests.py 2 files changed, 4 insertions(+), 4 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/page.py b/pywikibot/page.py index 767835d..f3025e0 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -367,7 +367,7 @@ title = title.replace(u' ', u'_') if asUrl: encodedTitle = title.encode(self.site.encoding()) - title = quote_from_bytes(encodedTitle) + title = quote_from_bytes(encodedTitle, safe='') if as_filename: # Replace characters that are not possible in file names on some # systems. diff --git a/tests/page_tests.py b/tests/page_tests.py index 14556b3..08cb8de 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -1106,16 +1106,16 @@ p1 = pywikibot.Page(site, 'User:Framawiki/pwb_tests/permalink') self.assertEqual(p1.permalink(), '//test.wikipedia.org/w/index.php?title=User%3A' - 'Framawiki/pwb_tests/permalink&oldid=340685') + 'Framawiki%2Fpwb_tests%2Fpermalink&oldid=340685') self.assertEqual(p1.permalink(oldid='340684'), '//test.wikipedia.org/w/index.php?title=User%3A' - 'Framawiki/pwb_tests/permalink&oldid=340684') + 'Framawiki%2Fpwb_tests%2Fpermalink&oldid=340684') self.assertEqual(p1.permalink(percent_encoded=False), '//test.wikipedia.org/w/index.php?title=User:' 'Framawiki/pwb_tests/permalink&oldid=340685') self.assertEqual(p1.permalink(with_protocol=True), 'https://test.wikipedia.org/w/index.php?title=User%3A' - 'Framawiki/pwb_tests/permalink&oldid=340685') + 'Framawiki%2Fpwb_tests%2Fpermalink&oldid=340685')
if __name__ == '__main__': # pragma: no cover