clokep / django-render-block

Render the content of a specific block tag from a Django template.
ISC License
241 stars 23 forks source link

Handles edge case where custom template tag defines child_nodelist at… #46

Closed topher235 closed 5 months ago

topher235 commented 1 year ago

…tr as None

Absolutely love the library. I've recently discovered django-render-block is incompatible with django-slippers.

When a template tag is encountered before finding our desired block and that template tag defines its child_nodelist attributes as None, the rendering blows up here since None is not iterable.

Since standard Django procedure is to create an empty NodeList and extend it when parsing, I'd say the onus of this should be put on the custom template tag definition to not set child nodelists to None. And I have opened a PR in the django-slippers repo as well. That said, I can't think of a side effect of including this here and it does handle the edge case where the attribute is explicitly defined as None.

clokep commented 5 months ago

Sorry for missing this PR, not sure what happened.

And I have opened a PR in the django-slippers repo as well.

mixxorz/slippers#49 for cross-reference.

It seems like this is fixed in the offending library which was not properly implementing the interface? Given that I'm tempted to close this.

topher235 commented 5 months ago

Given that I'm tempted to close this.

Fair! Mostly opened this PR as a "just in case you'd like this" since I had to do most of this to figure out the problem.

clokep commented 5 months ago

Yep, appreciate it and sorry for the delay in response!