From 04d8c46637a74855fa9281ccb3daa5290f417883 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Wed, 7 Feb 2007 04:40:14 +0000 Subject: [PATCH] * src/docgen/PdfDoc.py: provide a more useful error when reportlab crashes svn: r8071 --- ChangeLog | 3 +++ src/docgen/PdfDoc.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 91b066880..7360c617f 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'