diff options
author | Frederick Muriuki Muriithi | 2023-10-11 10:40:49 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-10-11 10:40:49 +0300 |
commit | 5573a4eabbd7bbdb55cb20f20f716279d9616f29 (patch) | |
tree | 90bd006825275adbdd09a0e71396419e039c396c /gn3 | |
parent | 9e6bb057c08d5216cb51f86b4acddca2ce7e0b11 (diff) | |
download | genenetwork3-5573a4eabbd7bbdb55cb20f20f716279d9616f29.tar.gz |
CaseAttribute: Reject a diff (delete file).
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/case_attributes.py | 11 |
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: |