I hadn't used Mako in maybe two years so the first few minutes were rough.
Start by reproducing the bug and isolating the template section causing the unexpected output. Systematically check each category (variable interpolation, control flow, inheritance/include, escaping) to identify the root cause, then apply the minimal fix and verify the corrected output. Finally, explain the original behavior and why the fix resolves it, emphasizing preventive measures.
Pro tip: Demonstrate deep Mako knowledge by mentioning that Mako does not autoescape by default, so you must explicitly use filters like `| h` or set `default_filters=['h']` to prevent HTML injection and unexpected rendering.
Run the script to confirm the unexpected output, then narrow down to the specific template block or expression responsible by commenting out sections or using debug prints.
Check each category: variable interpolation (e.g., missing `${}` or wrong variable name), control flow (e.g., incorrect loop/conditional logic), inheritance/include (e.g., wrong `inherit` or `include` path), and escaping (e.g., unescaped HTML).
Make the minimal change to correct the issue, such as adding `${}` around a variable, fixing a loop condition, correcting the inheritance directive, or adding an escape filter.
Re-run the script to confirm the corrected output, then walk through the original broken output and explain why the fix works, referencing Mako's behavior.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.