cobrateam / django-htmlmin

HTML minifier for Python frameworks (not only Django, despite the name).
http://pypi.python.org/pypi/django-htmlmin
BSD 2-Clause "Simplified" License
542 stars 73 forks source link

ValueError when using with gzip_page decorator #104

Open tremby opened 8 years ago

tremby commented 8 years ago

I'm getting a ValueError: object of type 'NoneType' has no len() when enabling minification and running a view which is decorated with django.views.decorators.gzip.gzip_page.

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 131, in get_response
    response = middleware_method(request, response)
  File "/usr/local/lib/python3.4/dist-packages/htmlmin/middleware.py", line 44, in process_response
    parser=parser)
  File "/usr/local/lib/python3.4/dist-packages/htmlmin/minify.py", line 45, in html_minify
    soup = bs4.BeautifulSoup(html_code, parser)
  File "/usr/local/lib/python3.4/dist-packages/bs4/__init__.py", line 192, in __init__
    elif len(markup) <= 256 and (
TypeError: object of type 'NoneType' has no len()
Diegow3b commented 7 years ago

Same here, when im activating GzipMiddleware im getting the same error

sikmir commented 6 years ago

The same problem.