aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-01-24 11:42:16 +0300
committerFrederick Muriuki Muriithi2023-01-24 11:42:16 +0300
commit1030425624b67b30073be512817661d45dceb93c (patch)
tree6c06ef3fcdac0b2746bdc7e8a21ab71d0748a678
parent5be55b1b33f5584942ded560e914b97557f68419 (diff)
downloadgenenetwork2-1030425624b67b30073be512817661d45dceb93c.tar.gz
correlations: Escape strings for html
Improves upon commit 63aff5ca22cfb5caaa38ac1d737afa48fc8dbf02
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 825aac70..06db20c2 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -18,6 +18,7 @@
#
# This module is used by GeneNetwork project (www.genenetwork.org)
+import html
import json
from base.trait import create_trait, jsonable
@@ -203,7 +204,8 @@ def populate_table(dataset_metadata, target_dataset, this_dataset, corr_results,
results_dict['mean'] = "N/A"
results_dict['additive'] = "N/A"
if target_trait['description'].strip():
- results_dict['description'] = target_trait['description'].strip().replace("<", "&lt;").replace(">", "&gt;")
+ results_dict['description'] = html.escape(
+ target_trait['description'].strip(), quote=True)
if target_trait['mean']:
results_dict['mean'] = f"{float(target_trait['mean']):.3f}"
try:
@@ -237,7 +239,8 @@ def populate_table(dataset_metadata, target_dataset, this_dataset, corr_results,
results_dict['abbreviation'] = target_trait['abbreviation']
if target_trait["description"].strip():
- results_dict['description'] = target_trait['description'].strip().replace("<", "&lt;").replace(">", "&gt;")
+ results_dict['description'] = html.escape(
+ target_trait['description'].strip(), quote=True)
if target_trait["mean"]:
results_dict['mean'] = f"{float(target_trait['mean']):.3f}"