Skip to content

Commit

Permalink
Merge pull request #597 from ScilifelabDataCentre/2024-10-04-fix-DCSS-87
Browse files Browse the repository at this point in the history
[DCSS 87] fix label editing
  • Loading branch information
Hammarn authored Oct 9, 2024
2 parents d975abf + d497da0 commit 8536e09
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion publications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import string
import sys

__version__ = "9.5.0"
__version__ = "9.5.1"


class Constants:
Expand Down
8 changes: 5 additions & 3 deletions publications/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io

import tornado.web
import tornado.escape

from publications import constants
from publications import settings
Expand Down Expand Up @@ -58,6 +59,7 @@ def get(self, identifier):
publications=list(
publications.subset.Subset(self.db, label=label["value"])
),
escaped_label=tornado.escape.url_escape(label['value']),
)

@tornado.web.authenticated
Expand Down Expand Up @@ -200,17 +202,17 @@ class LabelEdit(RequestHandler):
def get(self, identifier):
self.check_admin()
try:
label = self.get_label(identifier)
label = self.get_label(tornado.escape.url_unescape(identifier))
except KeyError as error:
self.see_other("labels", error=str(error))
return
self.render("label/edit.html", label=label)
self.render("label/edit.html", label=label, escaped_label=identifier)

@tornado.web.authenticated
def post(self, identifier):
self.check_admin()
try:
label = self.get_label(identifier)
label = self.get_label(tornado.escape.url_unescape(identifier))
except KeyError as error:
self.see_other("labels", error=str(error))
return
Expand Down
2 changes: 1 addition & 1 deletion publications/templates/label/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{% block meta_content %}
{% if is_admin %}
<p>
<a href="{{ reverse_url('label_edit', label['value']) }}"
<a href="{{ reverse_url('label_edit', escaped_label) }}"
class="btn btn-primary btn-block"
role="button">
<span class="glyphicon glyphicon-edit"></span> Edit
Expand Down
2 changes: 1 addition & 1 deletion publications/templates/label/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% end %} {# block body_title #}

{% block main_content %}
<form action="{{ reverse_url('label_edit', label['value']) }}"
<form action="{{ reverse_url('label_edit', escaped_label) }}"
method="POST" class="form-horizontal" role="form">
{% module xsrf_form_html() %}

Expand Down

0 comments on commit 8536e09

Please sign in to comment.