for value in changedMap.values(): for val in value: SanitationUtils.safePrint(val) dataMap = json2map(data) diffMap = listUtils.keysNotIn(dataMap, changedMap.keys()) if isinstance(changedMap, dict) else dataMap changeDataFmt.append( [ user_id, c_time, "C:%s<br/>S:%s" % (map2table(changedMap), map2table(diffMap)) ] ) print "creating report..." with io.open(repPath, 'w+', encoding='utf-8') as resFile: reporter = HtmlReporter() group = HtmlReporter.Group('changes', 'Changes') group.addSection( HtmlReporter.Section( 'wp_changes', 'Wordpress Changes', "modifications made to wordpress" + ( "since %s" % since if since else ""), data = re.sub("<table>","<table class=\"table table-striped\">", tabulate(changeDataFmt, headers="firstrow", tablefmt="html") ), length = len(changeDataFmt) ) ) resFile.write( SanitationUtils.coerceUnicode( reporter.getDocument() ))