From 120d8d756c99d4ac7675544922dd429d38ed548f Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Wed, 7 Feb 2007 04:37:32 +0000 Subject: [PATCH] * src/docgen/PdfDoc.py: provide a more useful error when reportlab crashes svn: r8070 --- gramps2/ChangeLog | 3 +++ gramps2/src/docgen/PdfDoc.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 889fb57b8..04b244e74 100644 --- a/gramps2/ChangeLog +++ b/gramps2/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/gramps2/src/docgen/PdfDoc.py b/gramps2/src/docgen/PdfDoc.py index 6edef3226..653d1bc69 100644 --- a/gramps2/src/docgen/PdfDoc.py +++ b/gramps2/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'