Merlijn van Deen has uploaded a new change for review. https://gerrit.wikimedia.org/r/184236
Change subject: Remove broken linebreak fixes ...................................................................... Remove broken linebreak fixes Python's universal newline should already take care of this; in addition to that, they were the wrong way around -- changing '\n' to '\r\n' when reading the file (while this should have been the other way around). This code was originally implemented in https://www.mediawiki.org/wiki/Special:Code/pywikipedia/3739 Change-Id: I78d97cdeb4632a038bc4c9eb1c9be67a63dfbed4 --- M pywikibot/editor.py 1 file changed, 6 insertions(+), 23 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/36/184236/1 diff --git a/pywikibot/editor.py b/pywikibot/editor.py index 1f877e3..c6999cc 100644 --- a/pywikibot/editor.py +++ b/pywikibot/editor.py @@ -57,22 +57,6 @@ pywikibot.log(u'Running editor: %s' % command) return command - def convertLinebreaks(self, text): - """Convert line-breaks.""" - if sys.platform == 'win32': - return text.replace('\r\n', '\n') - # TODO: Mac OS handling - return text - - def restoreLinebreaks(self, text): - """Restore line-breaks.""" - if text is None: - return - if sys.platform == 'win32': - return text.replace('\n', '\r\n') - # TODO: Mac OS handling - return text - def edit(self, text, jumpIndex=None, highlight=None): """ Call the editor and thus allows the user to change the text. @@ -89,7 +73,6 @@ file in his text editor @rtype: unicode or None """ - text = self.convertLinebreaks(text) if config.editor: tempFilename = '%s.%s' % (tempfile.mktemp(), config.editor_filename_extension) @@ -108,7 +91,7 @@ encoding=config.editor_encoding) as temp_file: newcontent = temp_file.read() os.unlink(tempFilename) - return self.restoreLinebreaks(newcontent) + return newcontent try: import gui # noqa @@ -120,8 +103,8 @@ 'are typically part of Python but may be packaged separately ' 'on your platform.\n' % e) - return self.restoreLinebreaks( - pywikibot.ui.editText( - text, - jumpIndex=jumpIndex, - highlight=highlight)) + return pywikibot.ui.editText( + text, + jumpIndex=jumpIndex, + highlight=highlight + ) -- To view, visit https://gerrit.wikimedia.org/r/184236 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I78d97cdeb4632a038bc4c9eb1c9be67a63dfbed4 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Merlijn van Deen <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
