aboutsummaryrefslogtreecommitdiff
path: root/gn3/case_attributes.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-10-11 10:40:49 +0300
committerFrederick Muriuki Muriithi2023-10-11 10:40:49 +0300
commit5573a4eabbd7bbdb55cb20f20f716279d9616f29 (patch)
tree90bd006825275adbdd09a0e71396419e039c396c /gn3/case_attributes.py
parent9e6bb057c08d5216cb51f86b4acddca2ce7e0b11 (diff)
downloadgenenetwork3-5573a4eabbd7bbdb55cb20f20f716279d9616f29.tar.gz
CaseAttribute: Reject a diff (delete file).
Diffstat (limited to 'gn3/case_attributes.py')
-rw-r--r--gn3/case_attributes.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index 68afae4..19d6c54 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -305,8 +305,10 @@ def __apply_diff__(
"system:inbredset:apply-case-attribute-edit"))
raise NotImplementedError
-def __reject_diff__(
- conn: Connection, inbredset_id: int, user: User, diff_filename) -> None:
+def __reject_diff__(conn: Connection,
+ inbredset_id: int,
+ user: User,
+ diff_filename: Path) -> Path:
"""
Reject the changes in the diff at `diff_filename` to the data in the
database if the user has appropriate privileges.
@@ -314,7 +316,10 @@ def __reject_diff__(
required_access(
inbredset_id, ("system:inbredset:edit-case-attribute",
"system:inbredset:apply-case-attribute-edit"))
- raise NotImplementedError
+ the_diff == __load_diff__(diff_filename)
+ __save_diff__(conn, the_diff, EditStatus.rejected)
+ os.remove(diff_filename)
+ return diff_filename
@caseattr.route("/<int:inbredset_id>/add", methods=["POST"])
def add_case_attributes(inbredset_id: int) -> Response: