diff --git a/bin/report/render/rml2pdf/customfonts.py b/bin/report/render/rml2pdf/customfonts.py index 11c35749d4c..ad97fec756b 100644 --- a/bin/report/render/rml2pdf/customfonts.py +++ b/bin/report/render/rml2pdf/customfonts.py @@ -21,6 +21,7 @@ from reportlab import rl_config import os +import logging """This module allows the mapping of some system-available TTF fonts to the reportlab engine. @@ -61,6 +62,7 @@ def FindCustomFonts(): meanwhile, the server must be restarted eventually. """ dirpath = [] + log = logging.getLogger('report.fonts') global __foundFonts for dirname in rl_config.TTFSearchPath: abp = os.path.abspath(dirname) @@ -72,7 +74,7 @@ def FindCustomFonts(): continue for d in dirpath: if os.path.exists(os.path.join(d, fname)): - # print "found font %s in %s" % (fname, d) + log.debug("Found font %s in %s as %s", fname, d, name) __foundFonts.append(fname) break diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index e9969fa4e52..bfb53fa2a16 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -31,6 +31,7 @@ import cStringIO import utils import color import os +import logging from lxml import etree import base64 from reportlab.platypus.doctemplate import ActionFlowable @@ -909,7 +910,11 @@ def parseNode(rml, localcontext = {},fout=None, images={}, path='.',title=None): try: from customfonts import SetCustomFonts SetCustomFonts(r) + except ImportError: + # means there is no custom fonts mapping in this system. + pass except Exception: + logging.getLogger('report').warning('Cannot set font mapping', exc_info=True) pass fp = cStringIO.StringIO() r.render(fp)