From 1e6c9060b51bf71e280e6649b272e6fa1f35b729 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 19 Mar 2021 10:31:29 +0100 Subject: [PATCH] better debug information --- src/rougail/template/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rougail/template/base.py b/src/rougail/template/base.py index 83c5a3cf..66aaa661 100644 --- a/src/rougail/template/base.py +++ b/src/rougail/template/base.py @@ -166,11 +166,14 @@ class RougailExtra: try: return self.suboption[key] except KeyError: - raise AttributeError + raise AttributeError(f'unable to find extra "{key}"') def __iter__(self): return iter(self.suboption.values()) + def items(self): + return self.suboption.items() + class RougailBaseTemplate: """Engine to process Creole cheetah template @@ -231,7 +234,7 @@ class RougailBaseTemplate: def instance_file(self, filevar: Dict, - type: str, + type_: str, service_name: str, ) -> None: """Run templatisation on one file @@ -253,7 +256,7 @@ class RougailBaseTemplate: var = variable[idx] else: var = None - func = f'_instance_{type}' + func = f'_instance_{type_}' data = getattr(self, func)(filevar, filename, service_name,