[FIX] fix (some) cStringIO problems

[IMP] remove debug code

bzr revid: christophe@tinyerp.com-20090109113525-5iq0uryv35ho4nwr
This commit is contained in:
Christophe Simonis 2009-01-09 12:35:25 +01:00
parent 25cbe16750
commit 383c212c97
2 changed files with 6 additions and 9 deletions

View File

@ -41,7 +41,8 @@ import release
import re
import base64
from zipfile import PyZipFile, ZIP_DEFLATED
import cStringIO
from cStringIO import StringIO
logger = netsvc.Logger()
@ -198,7 +199,7 @@ def get_module_as_zip(modulename, b64enc=True, src=True):
if os.path.isfile(ap + '.zip'):
val = file(ap + '.zip', 'rb').read()
else:
archname = cStringIO.StringIO('wb')
archname = StringIO()
archive = PyZipFile(archname, "w", ZIP_DEFLATED)
archive.writepy(ap)
_zippy(archive, ap, src=src)
@ -206,11 +207,6 @@ def get_module_as_zip(modulename, b64enc=True, src=True):
val = archname.getvalue()
archname.close()
### debug
f = file('/tmp/mod.zip', 'wb')
f.write(val)
f.close()
if b64enc:
val = base64.encodestring(val)
return val

View File

@ -224,10 +224,11 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False):
else:
zipname = tail
if zipfile.is_zipfile(head+'.zip'):
import cStringIO
from cStringIO import StringIO
zfile = zipfile.ZipFile(head+'.zip')
try:
fo = cStringIO.StringIO(zfile.read(os.path.join(
fo = StringIO()
fo.write(zfile.read(os.path.join(
os.path.basename(head), zipname).replace(
os.sep, '/')))