1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Description: Fix Node iteration error due to unsupported __iter__ function
When iterating over Template and Node objects directly, nodes may fail with an
exception such as: TypeError: 'TextNode' object is not iterable
This is due to iterating over nodes being unsupported in Django, as noted in
https://code.djangoproject.com/ticket/7430
To avoid this error, explicitly iterate over the nodelist attribute, rather
than relying on __iter__.
Author: Lena Voytek <lena.voytek@canonical.com>
Origin: backport, https://github.com/miracle2k/django-assets/pull/105/commits/af2440a107df0eac310cf3585b9f267ebe59f3dc
Last-Update: 2023-11-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/django_assets/loaders.py
+++ b/django_assets/loaders.py
@@ -107,6 +107,6 @@
and node.nodelist\
or []:
_recurse_node(subnode)
- for node in t: # don't move into _recurse_node, ``Template`` has a .nodelist attribute
+ for node in t.nodelist: # don't move into _recurse_node, ``Template`` has a .nodelist attribute
_recurse_node(node)
return result
|