jenkins-bot has submitted this change and it was merged.

Change subject: Allow non-urlencoded permalink
......................................................................


Allow non-urlencoded permalink

With browsers increasing their support for non-ascii urls the need
for the urlencode of the title is not always guaranteed. Adding an
optional parameter to permalink ensures this option becomes
available.

Change-Id: Ia7a5edd89347c6d1462fb220fd514469ac14dd83
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/page.py b/pywikibot/page.py
index faf693b..a9c4e7a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -460,16 +460,20 @@
         # TODO: what about redirects, errors?
         return self._revisions[oldid].text
 
-    def permalink(self, oldid=None):
+    def permalink(self, oldid=None, percent_encoded=True):
         """Return the permalink URL of an old revision of this page.
 
         @param oldid: The revid of the revision desired.
         @rtype: unicode
         """
+        if percent_encoded:
+            title = self.title(asUrl=True)
+        else:
+            title = self.title(asUrl=False).replace(' ', '_')
         return "//%s%s/index.php?title=%s&oldid=%s" \
                % (self.site.hostname(),
                   self.site.scriptpath(),
-                  self.title(asUrl=True),
+                  title,
                   (oldid if oldid is not None else self.latest_revision_id))
 
     @property

-- 
To view, visit https://gerrit.wikimedia.org/r/290215
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7a5edd89347c6d1462fb220fd514469ac14dd83
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>
Gerrit-Reviewer: Jean-Frédéric <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Lokal Profil <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to