changeset 5812:1d78194ecfeb editlogfixes

apply same fix to _conv160a as done for _conv160 in cs e1e79fab9cca
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 25 Dec 2011 16:38:04 +0100
parents e3f0b692c9a8
children 7d636ee769da 8a3755a601a8
files MoinMoin/script/migration/_conv160a.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/migration/_conv160a.py	Wed Oct 12 10:28:31 2011 +0200
+++ b/MoinMoin/script/migration/_conv160a.py	Sun Dec 25 16:38:04 2011 +0100
@@ -103,7 +103,8 @@
     def write(self, fname):
         """ write complete event-log to disk """
         if self.data:
-            f = file(fname, 'w')
+            f = file(fname, 'wb') # write in binary mode, so it stays exactly as we write it, even on windows.
+                                  # the code in MoinMoin.logfile also uses binary mode and writes \n only.
             for timestamp, action, kvdict in self.data:
                 pagename = kvdict.get('pagename')
                 if pagename and ('PAGE', pagename) in self.renames:
@@ -160,7 +161,8 @@
         if self.data:
             editlog = self.data.items()
             editlog.sort()
-            f = file(fname, "w")
+            f = file(fname, 'wb') # write in binary mode, so it stays exactly as we write it, even on windows.
+                                  # the code in MoinMoin.logfile also uses binary mode and writes \n only.
             max_rev = 0
             for key, fields in editlog:
                 timestamp, rev, action, pagename, ip, hostname, userid, extra, comment = fields