aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-28 10:33:53 +0300
committerFrederick Muriuki Muriithi2023-10-10 11:12:44 +0300
commit00a91a180b28984dafd01c5544df51943e7a5bee (patch)
tree7e7f67f11d4e55340f665eda0a468c7613c1f336 /gn3
parent3757c2bc9adcf687f1653c2b903aa1edbcafafb1 (diff)
downloadgenenetwork3-00a91a180b28984dafd01c5544df51943e7a5bee.tar.gz
Bug: Fix missing cursor object.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/case_attributes.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index 39052f9..1160678 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -53,7 +53,8 @@ def __case_attributes_by_inbred_set__(
Retrieve Case-Attributes by their InbredSet ID. Do not call this outside
this module.
"""
- cursor.execute(
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cursor.execute(
"SELECT ca.Name AS CaseAttributeName, "
"caxrn.Value AS CaseAttributeValue, s.Name AS StrainName, "
"s.Name2 AS StrainName2, s.Symbol, s.Alias "
@@ -65,8 +66,8 @@ def __case_attributes_by_inbred_set__(
"WHERE ca.InbredSetId=%(inbredset_id)s "
"ORDER BY StrainName",
{"inbredset_id": inbredset_id})
- return tuple(
- reduce(__by_strain__, cursor.fetchall(), {}).values())
+ return tuple(
+ reduce(__by_strain__, cursor.fetchall(), {}).values())
@caseattr.route("/<int:inbredset_id>/values", methods=["GET"])
def inbredset_case_attribute_values(inbredset_id: int) -> Response:
@@ -149,7 +150,7 @@ def edit_case_attributes(inbredset_id: int) -> Response:
return jsonify({
"diff-status": "queued",
"message": ("The changes to the case-attributes have been "
- "queued for approval.")
+ "queued for approval."),
"diff-filename": diff_filename
})