Skip to content

Commit 97c76ac

Browse files
the resolve title function was not called and has been fixed
1 parent ee0641c commit 97c76ac

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sde_collections/models/pattern.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from django.core.exceptions import ValidationError
55
from django.db import models
66

7-
from ..utils.title_resolver import is_valid_fstring, is_valid_xpath, parse_title
7+
from ..utils.title_resolver import (
8+
is_valid_fstring,
9+
is_valid_xpath,
10+
parse_title,
11+
resolve_title,
12+
)
813
from .collection_choice_fields import DocumentTypes
914

1015

@@ -161,9 +166,13 @@ def apply(self) -> None:
161166
ResolvedTitleError = apps.get_model("sde_collections", "ResolvedTitleError")
162167

163168
for candidate_url in matched_urls:
169+
context = {
170+
"url": candidate_url.url,
171+
"title": candidate_url.scraped_title,
172+
"collection": self.collection.name,
173+
}
164174
try:
165-
# generated_title = resolve_title(self.title_pattern, context)
166-
generated_title = self.title_pattern
175+
generated_title = resolve_title(self.title_pattern, context)
167176

168177
# check to see if the candidate url has an existing resolved title and delete it
169178
ResolvedTitle.objects.filter(candidate_url=candidate_url).delete()

0 commit comments

Comments
 (0)