aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-03-22 23:39:40 +0300
committerBonfaceKilz2024-03-26 10:01:13 +0300
commitef1f109e795845e2f50a7230da7ff292415df450 (patch)
tree7d02f93d5f5da79136d87b9e5d80fb0661993541 /gn2/wqflask
parent06ea37c38102249348fba005ef4a16b4cfcaaa1c (diff)
downloadgenenetwork2-ef1f109e795845e2f50a7230da7ff292415df450.tar.gz
Replace "__" prefix for with "_".
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/edit.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/gn2/wqflask/edit.py b/gn2/wqflask/edit.py
index 151769c1..36028861 100644
--- a/gn2/wqflask/edit.py
+++ b/gn2/wqflask/edit.py
@@ -58,22 +58,23 @@ push origin master --dry-run".split(" ")))
@require_oauth2
def metadata_edit():
from gn2.utility.tools import GN3_LOCAL_URL
- __name = request.args.get("name")
+ _name = request.args.get("name")
match request.args.get("type"):
case "dcat:Dataset":
- __metadata = requests.get(
+ _metadata = requests.get(
urljoin(
GN3_LOCAL_URL,
- f"api/metadata/datasets/{ __name }"
+ f"api/metadata/datasets/{ _name }"
)
).json()
- __section = request.args.get("section")
+ _section = request.args.get("section")
return render_template(
"metadata/editor.html",
- name=__name,
- metadata=__metadata,
- section=__section,
- edit=__metadata.get(__section),
+ name=_name,
+ metadata=_metadata,
+ section=_section,
+ edit=_metadata.get(_section),
+ )
)
@@ -81,11 +82,13 @@ def metadata_edit():
@require_oauth2
def save():
from gn2.utility.tools import get_setting
- __gn_docs = Path(
+ _gn_docs = Path(
get_setting("DATA_DIR"),
"gn-docs"
)
- __map = {
+ # This maps the form elements to the actual path in the git
+ # repository
+ _map = {
"description": "summary.rtf",
"tissueInfo": "tissue.rtf",
"specifics": "specifics.rtf",
@@ -99,20 +102,20 @@ def save():
"experimentType": "experiment-type.rtf",
"contributors": "contributors.rtf"
}
- __output = Path(
- __gn_docs,
+ _output = Path(
+ _gn_docs,
"general/datasets/",
request.form.get("id").split("/")[-1],
- f"{__map.get(request.form.get('section'))}"
+ f"{_map.get(request.form.get('section'))}"
)
match request.form.get("type"):
case "dcat:Dataset":
- __session = session_info()["user"]
- __author = f"{__session['name']} <{__session['email']}>"
+ _session = session_info()["user"]
+ _author = f"{_session['name']} <{_session['email']}>"
save_dataset_metadata(
- git_dir=__gn_docs,
- output=__output,
- author=__author,
+ git_dir=_gn_docs,
+ output=_output,
+ author=_author,
content=request.form.get("editor"),
msg=request.form.get("edit-summary")
).either(