[Checkins] SVN: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/cli.py taking extension of generated output file into account

Andreas Jung andreas at andreas-jung.com
Sun Jul 5 11:31:13 EDT 2009


Log message for revision 101587:
  taking extension of generated output file into account
  

Changed:
  U   zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/cli.py

-=-
Modified: zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/cli.py
===================================================================
--- zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/cli.py	2009-07-05 15:17:47 UTC (rev 101586)
+++ zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/cli.py	2009-07-05 15:31:13 UTC (rev 101587)
@@ -51,10 +51,12 @@
             result = self.convert(html_filename, 
                                   converter_name=converter_name)
 
+            basename, ext =  os.path.splitext(os.path.basename(result))
+
             # Generate result ZIP archive with base64-encoded result
             zip_out = os.path.join(tempdir, 'output.zip')
             ZF = zipfile.ZipFile(zip_out, 'w')
-            ZF.writestr('output.pdf', file(result, 'rb').read())
+            ZF.writestr('output.%s' % ext, file(result, 'rb').read())
             ZF.close()
             encoded_result = base64.encodestring(file(zip_out, 'rb').read())
             shutil.rmtree(tempdir)



More information about the Checkins mailing list