Skip to content

Commit 84e8a51

Browse files
committed
Add self.origin to context.seen in Extends::load_template
We had a similar bug to Django #28071, which we caught by running Django's own tests. https://code.djangoproject.com/ticket/28071
1 parent 01b5f28 commit 84e8a51

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/render/tags.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,16 +1075,17 @@ impl Extends {
10751075
context: &mut Context,
10761076
) -> Result<Template, PyErr> {
10771077
if context.seen.is_none() {
1078-
let seen = match &self.origin {
1079-
Some(origin) => vec![origin.clone()],
1080-
None => vec![],
1081-
};
1082-
context.seen = Some(seen);
1078+
context.seen = Some(vec![]);
10831079
}
1080+
10841081
let seen = context
10851082
.seen
10861083
.as_mut()
10871084
.expect("context.seen should be populated");
1085+
1086+
if let Some(origin) = &self.origin {
1087+
seen.push(origin.clone())
1088+
};
10881089
match get_template(
10891090
self.engine.clone(),
10901091
py,

0 commit comments

Comments
 (0)