From 292bf7baed7e96ab44085643f960014910835e53 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 20 Feb 2019 20:02:26 +0100 Subject: Allow referencing self as a variable (fixes #207) --- askama_derive/src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index b0630df..8f2866e 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1116,7 +1116,7 @@ impl<'a> Generator<'a> { } fn visit_var(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap { - if self.locals.contains(s) { + if self.locals.contains(s) || s == "self" { buf.write(s); } else { buf.write("self."); -- cgit