def _update_design(self, designdata): """Compile the report design if needed.""" designdata_hash = md5.new(designdata.encode('utf-8')).hexdigest() sourcepath = os.path.join(TMPDIR, 'reports') destinationpath = os.path.join(TMPDIR, 'compiled-reports') ensure_dirs([sourcepath, destinationpath]) source_design = os.path.join(sourcepath, designdata_hash + '.jrxml') compiled_design = os.path.join(destinationpath, designdata_hash + '.jasper') if not os.path.exists(compiled_design): sys.stderr.write("generating report %s\n" % compiled_design) uuid = gen_uuid() fdesc = open(source_design, 'w') fdesc.write(designdata.encode('utf-8')) fdesc.close() JasperCompileManager.compileReportToFile(source_design, compiled_design + uuid) os.rename(compiled_design + uuid, compiled_design) return compiled_design
def _update_design(self, designdata): """Compile the report design if needed.""" designdata_hash = md5.new(designdata.encode("utf-8")).hexdigest() sourcepath = os.path.join(TMPDIR, "reports") destinationpath = os.path.join(TMPDIR, "compiled-reports") ensure_dirs([sourcepath, destinationpath]) source_design = os.path.join(sourcepath, designdata_hash + ".jrxml") compiled_design = os.path.join(destinationpath, designdata_hash + ".jasper") if not os.path.exists(compiled_design): sys.stderr.write("generating report %s\n" % compiled_design) uuid = gen_uuid() fdesc = open(source_design, "w") fdesc.write(designdata.encode("utf-8")) fdesc.close() JasperCompileManager.compileReportToFile(source_design, compiled_design + uuid) os.rename(compiled_design + uuid, compiled_design) return compiled_design
def _update_design(self, designdata): """Compile the report design if needed.""" designdata_hash = hashlib.md5(designdata.encode('utf-8')).hexdigest() sourcepath = os.path.join(TMPDIR, 'reports') destinationpath = os.path.join(TMPDIR, 'compiled-reports') ensure_dirs([sourcepath, destinationpath]) source_design = os.path.join(sourcepath, designdata_hash + '.jrxml') compiled_design = os.path.join(destinationpath, designdata_hash + '.jasper') if not os.path.exists(compiled_design): fdesc = open(source_design, 'w') fdesc.write(designdata.encode('utf-8')) fdesc.close() uid = str(uuid.uuid1()) JasperCompileManager.compileReportToFile(source_design, compiled_design + uid) os.rename(compiled_design + uid, compiled_design) return compiled_design