aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2019-02-20 20:02:26 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2019-02-20 20:41:17 +0100
commit292bf7baed7e96ab44085643f960014910835e53 (patch)
treec94ec46ad2b5537616ea7134715fd86dd0356314 /askama_derive/src/generator.rs
parentc851edb29bb0242f4e0f6afb00f37ec59d15d7ef (diff)
downloadaskama-292bf7baed7e96ab44085643f960014910835e53.tar.gz
askama-292bf7baed7e96ab44085643f960014910835e53.tar.bz2
askama-292bf7baed7e96ab44085643f960014910835e53.zip
Allow referencing self as a variable (fixes #207)
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r--askama_derive/src/generator.rs2
1 files changed, 1 insertions, 1 deletions
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.");