[Checkins] SVN: zopyx.convert2/trunk/ merged error-handling branch
Andreas Jung
andreas at andreas-jung.com
Sat May 15 10:21:07 EDT 2010
Log message for revision 112333:
merged error-handling branch
Changed:
U zopyx.convert2/trunk/CHANGES.txt
U zopyx.convert2/trunk/setup.py
U zopyx.convert2/trunk/src/zopyx/convert2/calibre.py
A zopyx.convert2/trunk/src/zopyx/convert2/exceptions.py
U zopyx.convert2/trunk/src/zopyx/convert2/fo.py
U zopyx.convert2/trunk/src/zopyx/convert2/fop.py
U zopyx.convert2/trunk/src/zopyx/convert2/prince.py
U zopyx.convert2/trunk/src/zopyx/convert2/xfc.py
U zopyx.convert2/trunk/src/zopyx/convert2/xinc.py
-=-
Modified: zopyx.convert2/trunk/CHANGES.txt
===================================================================
--- zopyx.convert2/trunk/CHANGES.txt 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/CHANGES.txt 2010-05-15 14:21:07 UTC (rev 112333)
@@ -1,3 +1,7 @@
+2.2.0 (2010-05-15)
+==================
+- dedicated ConversionError exception added
+
2.1.1 (2010-02-19)
==================
- relaxed tidy check for existence of images
Modified: zopyx.convert2/trunk/setup.py
===================================================================
--- zopyx.convert2/trunk/setup.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/setup.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -12,7 +12,7 @@
'Programming Language :: Python',
]
-version = '2.1.1'
+version = '2.2.0'
desc = unicode(file('README.txt').read().strip(), 'utf-8')
changes = file('CHANGES.txt').read().strip()
Modified: zopyx.convert2/trunk/src/zopyx/convert2/calibre.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/calibre.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/calibre.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -11,6 +11,7 @@
from convert import BaseConverter
from util import runcmd, which, win32, checkEnvironment, newTempfile
from logger import LOG
+from exceptions import ConversionError
from tidy import tidyhtml
@@ -48,7 +49,8 @@
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
+ raise ConversionError('Error executing: %s' % cmd, output)
+
return dict(output_filename=output_filename,
status=status,
output=output)
Copied: zopyx.convert2/trunk/src/zopyx/convert2/exceptions.py (from rev 112332, zopyx.convert2/branches/error-handling/src/zopyx/convert2/exceptions.py)
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/exceptions.py (rev 0)
+++ zopyx.convert2/trunk/src/zopyx/convert2/exceptions.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -0,0 +1,18 @@
+##########################################################################
+# zopyx.convert2 - XSL-FO related functionalities
+#
+# (C) 2007, 2008, ZOPYX Ltd & Co. KG, Tuebingen, Germany
+##########################################################################
+
+class ConversionError(Exception):
+ """ Generic conversion exception holding and error message
+ and the output from the failed conversion.
+ """
+
+ def __init__(self, error_msg, output):
+ self.error_msg = error_msg
+ self.output = output
+
+ def __str__(self):
+ return '%s\nOutput:\n%s' % (self.error_msg, self.output)
+
Modified: zopyx.convert2/trunk/src/zopyx/convert2/fo.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/fo.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/fo.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -12,6 +12,7 @@
from tidy import tidyhtml
from util import newTempfile, runcmd, which, win32, checkEnvironment
from logger import LOG
+from exceptions import ConversionError
dirname = os.path.dirname(__file__)
@@ -51,7 +52,7 @@
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
+ raise ConversionError('Error executing: %s' % cmd, output)
# remove tidy-ed file
if tidy:
Modified: zopyx.convert2/trunk/src/zopyx/convert2/fop.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/fop.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/fop.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -10,6 +10,7 @@
from convert import BaseConverter
from util import runcmd, which, win32, checkEnvironment, newTempfile
from logger import LOG
+from exceptions import ConversionError
fop_home = os.environ.get('FOP_HOME')
@@ -41,7 +42,7 @@
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
+ raise ConversionError('Error executing: %s' % cmd, output)
return dict(output_filename=output_filename,
status=status,
Modified: zopyx.convert2/trunk/src/zopyx/convert2/prince.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/prince.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/prince.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -12,6 +12,7 @@
from logger import LOG
from tidy import tidyhtml
+from exceptions import ConversionError
def _check_prince():
if not which('prince'):
@@ -43,7 +44,7 @@
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
+ raise ConversionError('Error executing: %s' % cmd, output)
return dict(output_filename=output_filename,
status=status,
output=output)
Modified: zopyx.convert2/trunk/src/zopyx/convert2/xfc.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/xfc.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/xfc.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -10,6 +10,7 @@
from convert import BaseConverter
from util import runcmd, which, win32, checkEnvironment, newTempfile
from logger import LOG
+from exceptions import ConversionError
xfc_dir = os.environ.get('XFC_DIR')
@@ -43,9 +44,10 @@
else:
cmd = '"%s/fo2%s" "%s" "%s"' % (xfc_dir, format, fo_filename, output_filename)
+
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
+ raise ConversionError('Error executing: %s' % cmd, output)
return dict(output_filename=output_filename,
status=status,
Modified: zopyx.convert2/trunk/src/zopyx/convert2/xinc.py
===================================================================
--- zopyx.convert2/trunk/src/zopyx/convert2/xinc.py 2010-05-15 14:19:18 UTC (rev 112332)
+++ zopyx.convert2/trunk/src/zopyx/convert2/xinc.py 2010-05-15 14:21:07 UTC (rev 112333)
@@ -11,6 +11,7 @@
from util import runcmd, which, win32, checkEnvironment, newTempfile
from logger import LOG
+from exceptions import ConversionError
xinc_home = os.environ.get('XINC_HOME')
@@ -39,10 +40,10 @@
cmd = '%s\\bin\\windows\\xinc.exe -fo "%s" -pdf "%s"' % (xinc_home, fo_filename, output_filename)
else:
cmd = '"%s/bin/unix/xinc" -fo "%s" -pdf "%s"' % (xinc_home, fo_filename, output_filename)
+
status, output = runcmd(cmd)
if status != 0:
- raise RuntimeError('Error executing: %s' % cmd)
-
+ raise ConversionError('Error executing: %s' % cmd, output)
return dict(output_filename=output_filename,
status=status,
output=output)
More information about the checkins
mailing list