Skip to content

Commit abd5f79

Browse files
committed
Remove get_absolute_url
Giving another name to a stdlib function is not very helpful :)
1 parent a8fa22a commit abd5f79

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

naucse/views.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import datetime
33
import logging
44
import os
5-
import urllib.parse
5+
from urllib.parse import urljoin
66
from pathlib import Path
77

88
import ics
@@ -408,12 +408,6 @@ def get_relative_url(current, target):
408408
return rel
409409

410410

411-
def get_absolute_url(current, target):
412-
"""Get absolute url from the ``target``, which is relative to ``current``.
413-
"""
414-
return urllib.parse.urljoin(current, target)
415-
416-
417411
def relative_url_functions(current_url, course, lesson):
418412
"""Return relative URL generators based on current page.
419413
"""
@@ -489,7 +483,7 @@ def content_creator():
489483
# The urls are added twice to ``absolute_urls_to_freeze``
490484
# when the content is created.
491485
# But it doesn't matter, duplicate URLs are skipped.
492-
absolute_urls = [get_absolute_url(request.path, x) for x in cached["urls"]]
486+
absolute_urls = [urljoin(request.path, x) for x in cached["urls"]]
493487
absolute_urls_to_freeze.extend(absolute_urls)
494488

495489
return cached
@@ -538,12 +532,12 @@ def course_page(course, lesson, page, solution=None):
538532
if content is None:
539533
# the offer was accepted
540534
content = content_offer["content"]
541-
absolute_urls_to_freeze.extend([get_absolute_url(request.path, x)
535+
absolute_urls_to_freeze.extend([urljoin(request.path, x)
542536
for x in content_offer["urls"]])
543537
else:
544538
# the offer was rejected or the the fragment was not in cache
545539
arca.region.set(content_key, {"content": content, "urls": data_from_fork["content_urls"]})
546-
absolute_urls_to_freeze.extend([get_absolute_url(request.path, x)
540+
absolute_urls_to_freeze.extend([urljoin(request.path, x)
547541
for x in data_from_fork["content_urls"]])
548542

549543
# compatibility

0 commit comments

Comments
 (0)