[Erp5-report] r14507 - /erp5/trunk/utils/oood/dispatcher.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 16 18:29:13 CEST 2007
Author: bartek
Date: Wed May 16 18:29:12 2007
New Revision: 14507
URL: http://svn.erp5.org?rev=14507&view=rev
Log:
fixed packaging of composite html's; made use of the fact that we use only one worker (in multi-process version each will need its own tmp directory)
Modified:
erp5/trunk/utils/oood/dispatcher.py
Modified: erp5/trunk/utils/oood/dispatcher.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/dispatcher.py?rev=14507&r1=14506&r2=14507&view=diff
==============================================================================
--- erp5/trunk/utils/oood/dispatcher.py (original)
+++ erp5/trunk/utils/oood/dispatcher.py Wed May 16 18:29:12 2007
@@ -388,7 +388,7 @@
if kw.get('newfilename'): # worker produced data and saved it in a new file
# XXX here we will also zip html files
try: # we can do it only if the argument is a string
- tozip = kw.get('extension').startswith('html') # if html, we pack the output files
+ tozip = kw.get('extension').endswith('html') # if html, we pack the output files
except AttributeError:
tozip = False
if tozip:
@@ -419,16 +419,15 @@
arch = cStringIO.StringIO()
pack = zipfile.ZipFile(arch, 'a')
r = re.compile(kw['extension'] + '$')
- for f in glob.glob(fullname + '*'):
+ for f in glob.glob('tmp/*'):
name = os.path.basename(f)
- # fix html extension
- name = r.sub('html', name)
pack.write(f, name)
pack.close()
arch.seek(0)
kw['data'] = arch.read()
arch.close()
kw['mime'] = 'application/zip' # generation returns mime type
+ kw['newfilename'] += '.zip'
def _safeRemove(self, filename):
"""
@@ -438,12 +437,12 @@
return
any = False
pth = os.path.join(config.oood_home, 'tmp', os.path.basename(filename))
- for f in glob.glob(pth + '*'):
+ for f in glob.glob('tmp/*'):
if not config.debug_mode:
- os.remove(self._mkName(f))
+ os.remove(f)
any = True
- if not any:
- Log.warning('no file beginning with %s' % filename)
+ #if not any:
+ #Log.warning('no file beginning with %s' % filename)
def _mkName(self, fname):
"""
More information about the Erp5-report
mailing list