[cpif] r412 - trunk/backend

svn at argo.es svn at argo.es
Fri Oct 19 23:51:10 CEST 2007


Author: jcea
Date: Fri Oct 19 23:51:09 2007
New Revision: 412

Log:
Los ficheros binarios deben leerse como "binarios".

Bendito sea probar las cosas en varias plataformas.

Gracias a Davidmh por ayudarme a identificar este
problema bajo MS-Windows.



Modified:
   trunk/backend/database.py

Modified: trunk/backend/database.py
==============================================================================
--- trunk/backend/database.py	(original)
+++ trunk/backend/database.py	Fri Oct 19 23:51:09 2007
@@ -235,7 +235,7 @@
 
   for i in files.keys() :
     i=i.replace("/",os.sep)
-    img=open(os.path.join(directory,i)).read()
+    img=open(os.path.join(directory,i),"rb").read()  # Binary data *must* be read as binary under MS-Windows
     result,img_metadata=check_image(img)
     if result : raise RuntimeError("ERROR al cargar los iconos:",result)
     files[i]=save_static(conn,"smileys",img,img_metadata,update=False)



More information about the cpif mailing list