`next.body()` raises an error when not called in an inherited context
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 459
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Migrated issue, originally created by jvanasco (@jvanasco)
I noticed this while bugfixing some parent templates in an inheritance chain.
The following is raised when the template containing ${next.body()} is called directly:
AttributeError: 'builtin_function_or_method' object has no attribute 'body'
While this makes sense, I think there are better ways to handle it:
a_ raise a custom error that says "You're calling this direct, must inherit"
b_ [preferred] just return an empty string value when there is no next
I think the latter behavior is better for introductory users.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the direct template call containing ${next.body()} described in the issue, then trace how next.body() is resolved outside an inheritance chain. The change is done when that direct call returns an empty string, with a regression test covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100