Django 4.0 compatibility issue: Node.render should return a string #166
Labels
bug
Something isn't working
decision needed
This requires a decision
django
Related to Django templates capabilities
Milestone
Issue Summary
cc @nickmoreton who fixed our test data in #165. Our test suite was failing in Django 4.0 because the new version of Django assumes the output of
Node.render
is a string. The error we got in our test suites was from Django’s templates rendering:This was a misc. performance improvement – from the release notes:
Corresponding PR: django/django#14503, and blame of those three lines.
Steps to Reproduce
Use this library and override a tag by providing raw data, with a value other than a string as the tag output.
Potential fixes
One option would be for us to re-introduce this casting for backwards compatibility. I believe it’s only needed here:
django-pattern-library/pattern_library/monkey_utils.py
Line 78 in dffd369
Another option would be to keep our implementation as-is and document the issue so people upgrading to Django 4.0 are aware they’ll need to change their
raw
definitions to be strings. We’d also want to remove/change the test cases updated in #165, as right now they aren’t testing much. We could also consider adding anassert
for this in our code / check the type and throw a custom exception. Not too sure if worthwhile or not.The text was updated successfully, but these errors were encountered: