diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 801db37fb..866fd7b7c 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1721,8 +1721,11 @@ impl MapChain<'_, &str, LocalMeta> { } fn resolve_or_self(&self, name: &str) -> String { - self.resolve(name) - .unwrap_or_else(|| format!("self.{}", name)) + match self.resolve(name) { + Some(name) => name, + None if name.chars().any(char::is_uppercase) => name.to_string(), + None => format!("self.{}", name), + } } }