diff --git a/ChangeLog b/ChangeLog index 889fb57b8..04b244e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-02-06 Brian Matherly + * src/docgen/PdfDoc.py: provide a more useful error when reportlab crashes + 2007-02-06 Douglas Blank * src/ReportBase/_ReportDialog.py: 0000905: Typo in catching exceptions in buggy reports diff --git a/src/docgen/PdfDoc.py b/src/docgen/PdfDoc.py index 6edef3226..653d1bc69 100644 --- a/src/docgen/PdfDoc.py +++ b/src/docgen/PdfDoc.py @@ -69,6 +69,7 @@ try: import reportlab.graphics.shapes import reportlab.lib.styles from reportlab.pdfbase.pdfmetrics import * + from reportlab.platypus.doctemplate import LayoutError for faceName in reportlab.pdfbase.pdfmetrics.standardFonts: reportlab.pdfbase.pdfmetrics.registerTypeFace( @@ -185,6 +186,18 @@ class PdfDoc(BaseDoc.BaseDoc): except IOError,msg: errmsg = "%s\n%s" % (_("Could not create %s") % self.filename, msg) raise Errors.ReportError(errmsg) + except LayoutError,msg: + if str(msg).rfind("too large on page") > -1: + errmsg = "Reportlab is unable to layout your report. " + \ + "This is probably because you have some text that " + \ + "is too large to fit on one page or in one cell. " + \ + "Try changing some report options or use a " + \ + "different output format." + else: + errmsg = "Reportlab is unable to layout your report. " + \ + "Try changing some report options or use a " + \ + "different output format." + raise Errors.ReportError(errmsg) if self.print_req: apptype = 'application/pdf'