TemplateNotFound errors when the same context is passed to django_render_block multiple times
See original GitHub issueAs of 0.8, django_render_block(...)
was modified to preserve the original context object if it had the type django.template.Context
. Unfortunately, context objects are mutable and this has resulted in odd behaviour if django_render_block is called multiple times with the same context object. In our case, we started seeing TemplateNotFound errors because Django’s templating engine skipped templates it thought it had already parsed.
This is a somewhat urgent issue, because django-templated-email has an unpinned dependency on django-render-block and calls django_render_block multiple times with the same context: https://github.com/vintasoftware/django-templated-email/blob/cba05a7b0f355acdc18174acd1ae468ad77e023d/templated_email/backends/vanilla_django.py#L106
The solution should be as simple as making a deep copy of the context object instead of using it directly.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top GitHub Comments
No problems! Thank you for taking the time to maintain such a useful library 😃
I just pushed 0.8.1 which includes the fix. Thanks so much! 👍