Author: mac
Date: Wed May 27 17:02:35 2009
New Revision: 29779
Log:
Slightly better handling of errors when calling LaTeX.
Modified:
DTMLTeX/trunk/ChangeLog
DTMLTeX/trunk/DTMLTeX.py
DTMLTeX/trunk/LaTeXClass.py
DTMLTeX/trunk/__init__.py
DTMLTeX/trunk/dtml/texAdd.dtml
DTMLTeX/trunk/dtvarpatch.py
DTMLTeX/trunk/filepatch.py
DTMLTeX/trunk/stxdocpatch.py
DTMLTeX/trunk/tests/testDTMLTeXFile.py
DTMLTeX/trunk/texvar.py
Modified: DTMLTeX/trunk/ChangeLog
==============================================================================
--- DTMLTeX/trunk/ChangeLog (original)
+++ DTMLTeX/trunk/ChangeLog Wed May 27 17:02:35 2009
(at)(at) -2,13 +2,7 (at)(at)
- Ensured necessary reruns of longtable environments are recongnized.
-Version 0.7pre5
-
- - ???
-
-Version 0.7pre4
-
- - ???
+ - Slightly better handling of errors when calling LaTeX.
Version 0.7pre3
(at)(at) -117,7 +111,7 (at)(at)
to Ivo van der Wijk.
- You can optionally view the rendered DTML code instead of passing it to
- the TeX interpreter, by putting "tex_raw" in the Request.
+ the TeX interpreter, by putting "tex_raw" in the Request.
- Some code cleanups.
Modified: DTMLTeX/trunk/DTMLTeX.py
==============================================================================
--- DTMLTeX/trunk/DTMLTeX.py (original)
+++ DTMLTeX/trunk/DTMLTeX.py Wed May 27 17:02:35 2009
(at)(at) -50,7 +50,7 (at)(at)
def add(self, id, title='', file='', REQUEST=None, submit=None):
"""Add a DTML TeX object with the contents of file. If
'file' is empty, default document text is used."""
-
+
if type(file) is not type(''): file=file.read()
ob = DTMLTeX(file, __name__=id)
ob.title = title
(at)(at) -74,7 +74,7 (at)(at)
commands = {}
commands.update(DTMLMethod.commands)
commands['texvar'] = texvar.TEXVar
-
+
index_html = None # Prevent accidental acquisition
manage_options = DTMLMethod.manage_options + \
(at)(at) -228,7 +228,7 (at)(at)
"Content-Disposition",
"attachment; filename=%s.tex" % filename)
return tex_code
-
+
# OK, we're still here. This means we have to throw the stuff
# at the typesetter.
try:
(at)(at) -280,7 +280,7 (at)(at)
texbasedot = tex[:-3]
output = texbasedot + ext
log = texbasedot + 'log'
-
+
# create temporary tex file
write(handle, tex_code)
close(handle)
(at)(at) -299,11 +299,16 (at)(at)
(binary, '-interaction=batchmode', tex)):
raise 'CommandError'
runs += 1
- except ('CommandError', OSError):
+ except ('CommandError', OSError), e:
# OSError occurs on Win when a file (e.g. image) is not found
- logdata = file(log).readlines()
+ try:
+ logdata = file(log).readlines()
+ except IOError:
+ if e is None:
+ e = 'spawnv returned a value <> 0'
+ logdata = [e]
raise 'LatexError', logdata
-
+
logdata = file(log).readlines()
# if the output contains hints about rerunning the
(at)(at) -317,7 +322,7 (at)(at)
if line == "! Emergency stop." or \
line == "No pages of output.":
raise 'LatexError', logdata
-
+
out = file(output, "rb").read()
finally:
chdir(cwd)
(at)(at) -338,7 +343,7 (at)(at)
errlog = ""
for line in logdata:
line = html_quote(line);
-
+
if contline:
stripped_line = line.lstrip()
whitespace = line[:len(line)-len(stripped_line)]
Modified: DTMLTeX/trunk/LaTeXClass.py
==============================================================================
--- DTMLTeX/trunk/LaTeXClass.py (original)
+++ DTMLTeX/trunk/LaTeXClass.py Wed May 27 17:02:35 2009
(at)(at) -9,7 +9,7 (at)(at)
######################################################################
"""LaTeXClass parses structured text into LaTeX.
-$Id: LaTeXClass.py,v 1.4 2004/03/09 14:32:16 thomas Exp $"""
+$Id$"""
class LaTeXClass:
"""LaTeXClass parses structured text into LaTeX."""
Modified: DTMLTeX/trunk/__init__.py
==============================================================================
--- DTMLTeX/trunk/__init__.py (original)
+++ DTMLTeX/trunk/__init__.py Wed May 27 17:02:35 2009
(at)(at) -9,7 +9,7 (at)(at)
######################################################################
"""DTMLTeX initialization.
-$Id: __init__.py,v 1.8 2005/01/11 22:09:54 thomas Exp $"""
+$Id$"""
import DTMLTeX
from zLOG import *
Modified: DTMLTeX/trunk/dtml/texAdd.dtml
==============================================================================
--- DTMLTeX/trunk/dtml/texAdd.dtml (original)
+++ DTMLTeX/trunk/dtml/texAdd.dtml Wed May 27 17:02:35 2009
(at)(at) -8,7 +8,7 (at)(at)
#
######################################################################
-$Id: texAdd.dtml,v 1.4 2004/03/08 18:21:51 thomas Exp $
+$Id$
</dtml-comment>
<dtml-var manage_page_header>
Modified: DTMLTeX/trunk/dtvarpatch.py
==============================================================================
--- DTMLTeX/trunk/dtvarpatch.py (original)
+++ DTMLTeX/trunk/dtvarpatch.py Wed May 27 17:02:35 2009
(at)(at) -9,7 +9,7 (at)(at)
######################################################################
"""Convert structured text into LaTeX.
-$Id: dtvarpatch.py,v 1.3 2004/03/08 22:11:19 thomas Exp $"""
+$Id$"""
from zLOG import *
Modified: DTMLTeX/trunk/filepatch.py
==============================================================================
--- DTMLTeX/trunk/filepatch.py (original)
+++ DTMLTeX/trunk/filepatch.py Wed May 27 17:02:35 2009
(at)(at) -10,7 +10,7 (at)(at)
"""A patch to Zope's File content type for temporarily writing files
from the ZODB to disk where TeX can find them.
-$Id: filepatch.py,v 1.1 2005/01/11 22:04:08 thomas Exp $"""
+$Id$"""
#Python imports
Modified: DTMLTeX/trunk/stxdocpatch.py
==============================================================================
--- DTMLTeX/trunk/stxdocpatch.py (original)
+++ DTMLTeX/trunk/stxdocpatch.py Wed May 27 17:02:35 2009
(at)(at) -9,7 +9,7 (at)(at)
######################################################################
"""Render the document into PDF using LaTeX.
-$Id: stxdocpatch.py,v 1.4 2004/03/09 14:32:16 thomas Exp $"""
+$Id$"""
from zLOG import *
Modified: DTMLTeX/trunk/tests/testDTMLTeXFile.py
==============================================================================
--- DTMLTeX/trunk/tests/testDTMLTeXFile.py (original)
+++ DTMLTeX/trunk/tests/testDTMLTeXFile.py Wed May 27 17:02:35 2009
(at)(at) -7,7 +7,7 (at)(at)
#######################################################################
"""Testcases for DTMLTeXFile
-$Id: testDTMLTeXFile.py,v 1.2 2004/03/08 18:21:51 thomas Exp $"""
+$Id$"""
import unittest
Modified: DTMLTeX/trunk/texvar.py
==============================================================================
--- DTMLTeX/trunk/texvar.py (original)
+++ DTMLTeX/trunk/texvar.py Wed May 27 17:02:35 2009
(at)(at) -10,7 +10,7 (at)(at)
"""A DTML tag that allows modification of the value with respect
to tex specifics.
-$Id: texvar.py,v 1.12 2005/04/12 08:28:18 mac Exp $"""
+$Id$"""
# Zope imports
|