Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/preview_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def for_object(
try:
internal_url = obj.get_absolute_url()
except NoReverseMatch:
internal_url = "javascript:alert('Could not load a view for this type of result')"
internal_url = None

if genome_builds is None:
if hasattr(obj, "genome_build") and (genome_build := obj.genome_build):
Expand Down
2 changes: 1 addition & 1 deletion library/utils/database_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def sql_delete_qs(qs, batch_size: Optional[int] = None) -> int:
pk_qs = qs.values_list("pk", flat=True)
meta = qs.model._meta
if batch_size:
limit = f"LIMIT {batch_size}"
limit = f"LIMIT {int(batch_size)}"
else:
limit = ""

Expand Down
2 changes: 1 addition & 1 deletion library/utils/diff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def html(self):
# return SafeString(f"<span class='diff-text'>{escape(self.input.text)}</span>")
# else:
return SafeString("<span class='diff-text'>" + "".join(
f"<span class='diff-text-{diff.operation_name}'>{escape(diff.text)}</span>" for diff in self.diffs
f"<span class='diff-text-{escape(diff.operation_name)}'>{escape(diff.text)}</span>" for diff in self.diffs
) + "</span>")

def append(self, op: str, segment: str) -> 'MultiDiffOutput':
Expand Down
2 changes: 1 addition & 1 deletion library/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def add_permissions_to_file(filename: str, add_stat: int):
try:
os.chmod(filename, st.st_mode | add_stat)
except Exception as e:
logging.error("Path '%s' stat is %s", filename, st)
logging.debug("Path '%s' stat is %s", filename, st)
raise e


Expand Down
9 changes: 1 addition & 8 deletions library/utils/html_utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import html
import re
import uuid
from html import escape
from typing import Optional

from bs4 import BeautifulSoup
from django.utils.safestring import mark_safe, SafeString
from django.utils.safestring import SafeString


def html_id_safe(text: str) -> str:
Expand All @@ -22,12 +21,6 @@ def html_id_safe(text: str) -> str:
return text


def html_link(url: str, title: str) -> SafeString:
if not url:
return mark_safe(title)
return mark_safe(f"<a href='{url}'>{html.escape(title)}</a>")


# note this tags expected in a single line of text
# don't catch too many tags in case you get some false positives
EXPECTED_HTML_TAGS_SINGLE_LINE = {'div', 'b', 'i', 'u', 'strong', 'em', 'sup', 'sub'}
Expand Down
Loading