jazzband / sorl-thumbnail

Thumbnails for Django
https://sorl-thumbnail.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.74k stars 497 forks source link

ThumbnailNode child_nodelists 'nodelist_file' is not a list #470

Open Ecno92 opened 8 years ago

Ecno92 commented 8 years ago

Today I hit a exception while I was trying to compress with Django compressor. I was not the only one who was seeing this exception. So I quickly found a open PR for that. It seemed like more people were seeing this exception in combination with sorl-thumbnail.

https://github.com/django-compressor/django-compressor/pull/605

As you can see in this pull request it tries to patch the fact that a nodelist of a node may not return a list which crashes the compressor.

The ThumbnailNode contains a 'nodelist_file' in the child_nodelists attribute. As you read the code you see that this value may stay None.

I'm not sure if his is correct. The NodeList class of the django template base module inherits from a list. So it seems that 'nodelist_file' should also be a (empty) list. https://github.com/django/django/blob/master/django/template/base.py#L984

Can someone check this situation and provide us feedback so we get more insights if the 'nodelist_file' attribute should remain like it is or if it should be changed.

jaddison commented 7 years ago

I have seen this exact same behaviour.

jaddison commented 6 years ago

This is still a problem with django-compressor.

jaddison commented 6 years ago

The fix has been merged into django-compressor's develop branch, but has not been released on PyPi yet.