Malafaya has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238149

Change subject: Changes are wrongly detected in the last langlink
......................................................................

Changes are wrongly detected in the last langlink

This was first detected in cosmetic_changes.py, where pages not undergoing any
cosmetic changes were being updated, and the supposed changed was an unchanged
langlink (the last one). Then I realized this also happens in interwiki.py, but
only when changes are supposed to be made to the page.
After checking textlib.py, I noticed that removeLanguageLinks() returns a
stripped version of the text whereas replaceLanguageLinks() does not. So the
actual difference is related to blank space.
This explains why cosmetic_changes.py detects a change and updates the page,
but interwiki.py does not: interwiki.py does not rely in differences in the
final text to make an update, but when it does need to make an update, it
outputs that diff.

This patch strips the text in replaceLanguageLinks() before returning.

Change-Id: Icd7252be8dbccf3fb04a4b4a465f6b057e3a8e3a
---
M pywikibot/textlib.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/49/238149/1

diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 5c13101..bc93290 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -910,7 +910,7 @@
                     newtext = s2.replace(marker, '').strip() + separator + s
     else:
         newtext = s2.replace(marker, '')
-    return newtext
+    return newtext.strip()
 
 
 def interwikiFormat(links, insite=None):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd7252be8dbccf3fb04a4b4a465f6b057e3a8e3a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Malafaya <malaf...@clix.pt>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to