fix open call to make cw happy /win32 3.5
authorAurelien Campeas
Tue, 08 Sep 2009 20:03:32 +0200
branch3.5
changeset 3122 0e49d2679c5c
parent 3118 9e7a155bc4e5
child 3123 5ce118f80936
fix open call to make cw happy /win32
web/views/__init__.py
--- a/web/views/__init__.py	Tue Sep 08 14:13:36 2009 +0200
+++ b/web/views/__init__.py	Tue Sep 08 20:03:32 2009 +0200
@@ -8,8 +8,8 @@
 __docformat__ = "restructuredtext en"
 
 import os
+import sys
 import tempfile
-
 from rql import nodes
 
 
@@ -110,13 +110,14 @@
         self.cell_call()
 
     def cell_call(self, row=0, col=0):
-        self.row, self.col = row, col # in case one need it
+        self.row, self.col = row, col # in case one needs it
         _, tmpfile = tempfile.mkstemp('.png')
         try:
             self._generate(tmpfile)
-            self.w(open(tmpfile).read())
+            self.w(open(tmpfile, 'rb').read())
         finally:
             try:
                 os.unlink(tmpfile)
             except Exception, ex:
-                self.warning('cant delete %s: %s', tmpfile, ex)
+                if sys.platform != 'win32':
+                      self.warning("can't delete %s : %s" % (tmpfile, ex))