django-cms / django-sekizai

Django Template Blocks with extra functionality
https://django-sekizai.readthedocs.io/
Other
459 stars 66 forks source link

fix: cms check management command gives up when templates use {% with_data %} template tag #142

Closed fsbraun closed 2 years ago

fsbraun commented 2 years ago

This PR fixes #118 and https://github.com/django-cms/django-cms/issues/6911.

./manage.py cms check failed for sekizai if the cms templates use the {% data_with %} template tag.

The reason is that both data_with and render_block template tags need to render the remaining nodes of the template before being able to render the content (since add_data or add_to_block might add information). Therefore both use the SekizaiParser which stores the rest of the template unprocessed in a nodelist. Upon rendering the tag, the node list is processed first, then the tag is rendered and the node list just appended.

_scan_namespaces took care of this in case of render_block but not in case of data_with. This PR now adds both tags for the special treatment.

codecov[bot] commented 2 years ago

Codecov Report

Merging #142 (1f1e90f) into master (06783ce) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #142   +/-   ##
=======================================
  Coverage   96.69%   96.69%           
=======================================
  Files           5        5           
  Lines         212      212           
  Branches       44       34   -10     
=======================================
  Hits          205      205           
  Misses          4        4           
  Partials        3        3           
Impacted Files Coverage Δ
sekizai/helpers.py 95.83% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.