|
16 | 16 | from werkzeug.local import LocalProxy |
17 | 17 |
|
18 | 18 | from naucse import models |
19 | | -from naucse.freezer import temporary_url_for_logger |
| 19 | +from naucse.freezer import temporary_url_for_logger, record_url |
20 | 20 | from naucse.models import allowed_elements_parser |
21 | 21 | from naucse.templates import setup_jinja_env, vars_functions |
22 | 22 | from naucse.urlconverters import register_url_converters |
|
26 | 26 | from naucse.utils.models import arca |
27 | 27 | from naucse.utils.views import get_recent_runs, list_months |
28 | 28 | from naucse.utils.views import does_course_return_info |
29 | | -from naucse.utils.views import absolute_urls_to_freeze, raise_errors_from_forks |
| 29 | +from naucse.utils.views import raise_errors_from_forks |
30 | 30 | from naucse.utils.views import page_content_cache_key, get_edit_info |
31 | 31 | from naucse.validation import DisallowedStyle, DisallowedElement, InvalidHTML |
32 | 32 |
|
@@ -485,11 +485,10 @@ def content_creator(): |
485 | 485 | content_key = page_content_cache_key(Repo("."), lesson.slug, page.slug, solution, variables) |
486 | 486 | cached = arca.region.get_or_create(content_key, content_creator) |
487 | 487 |
|
488 | | - # The urls are added twice to ``absolute_urls_to_freeze`` |
489 | | - # when the content is created. |
| 488 | + # The urls are recorded twice when the content is created. |
490 | 489 | # But it doesn't matter, duplicate URLs are skipped. |
491 | | - absolute_urls = [urljoin(request.path, x) for x in cached["urls"]] |
492 | | - absolute_urls_to_freeze.extend(absolute_urls) |
| 490 | + for x in cached["urls"]: |
| 491 | + record_url(urljoin(request.path, x)) |
493 | 492 |
|
494 | 493 | return cached |
495 | 494 |
|
@@ -537,13 +536,13 @@ def course_page(course, lesson, page, solution=None): |
537 | 536 | if content is None: |
538 | 537 | # the offer was accepted |
539 | 538 | content = content_offer["content"] |
540 | | - absolute_urls_to_freeze.extend([urljoin(request.path, x) |
541 | | - for x in content_offer["urls"]]) |
| 539 | + for x in content_offer["urls"]: |
| 540 | + record_url(urljoin(request.path, x)) |
542 | 541 | else: |
543 | 542 | # the offer was rejected or the the fragment was not in cache |
544 | 543 | arca.region.set(content_key, {"content": content, "urls": data_from_fork["content_urls"]}) |
545 | | - absolute_urls_to_freeze.extend([urljoin(request.path, x) |
546 | | - for x in data_from_fork["content_urls"]]) |
| 544 | + for x in data_from_fork["content_urls"]: |
| 545 | + record_url(urljoin(request.path, x)) |
547 | 546 |
|
548 | 547 | # compatibility |
549 | 548 | page = process_page_data(data_from_fork.get("page")) |
|
0 commit comments