Merge pull request #20414 from mvdbeek/fix_cheetah_app_access_python_3_13

[25.0] Fix $app attribute access in cheetah templates
This commit is contained in:
John Chilton
2025-06-09 14:49:27 -04:00
committed by GitHub
+7
View File
@@ -46,3 +46,10 @@ class Container(LagomContainer):
return self[dep_type]
except UnresolvableType:
return None
def __getitem__(self, dep_type: Type[T]) -> T:
if isinstance(dep_type, str):
# Workaround for accessing attributes of $app inside cheetah templates.
# Cheetah's searchList implementation tests access via __getitem__ before __getattr__.
return getattr(self, dep_type) # type: ignore[unreachable]
return self.resolve(dep_type)