changeset 1321:cc7067f61939

Windows support for moin load/save, fixes #66 "test moin load/save on windows, fix if needed"'
author "Miks Kalnins <MiksKalnins@MaikuMori.com>"
date Sun, 08 Apr 2012 15:15:13 +0300
parents 8fa27ecd73f8
children 04c5899fc02b
files MoinMoin/script/maint/serialization.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/serialization.py	Sat Mar 31 12:48:37 2012 -0700
+++ b/MoinMoin/script/maint/serialization.py	Sun Apr 08 15:15:13 2012 +0300
@@ -27,6 +27,11 @@
 
     def run(self, filename=None):
         if filename is None:
+            # On Windows force the stdout to be in binary mode.
+            if sys.platform == "win32":
+                import os, msvcrt
+                msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
             f = sys.stdout
         else:
             f = open(filename, "wb")
@@ -44,6 +49,11 @@
 
     def run(self, filename=None):
         if filename is None:
+            # On Windows force the stdin to be in binary mode.
+            if sys.platform == "win32":
+                import os, msvcrt
+                msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+
             f = sys.stdin
         else:
             f = open(filename, "rb")