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

NameError: name 'unicode' is not defined #85

Closed ghost closed 9 years ago

ghost commented 9 years ago

I am using Django 1.8.2 on Python 3.4.2. I have added the appropriate middleware classes and set HTML_MINIFY = True in order to test it while having DEBUG on.

When I run my development server, I get a "NameError" type of error, with the message "name 'unicode' is not defined".

Exception Value:    
name 'unicode' is not defined
Exception Location: /Users/drcooldude/Desktop/testproject/env/lib/python3.4/site-packages/htmlmin/minify.py in html_minify, line 43
Python Executable:  /Users/drcooldude/Desktop/testproject/env/bin/python

Traceback:
File "/Users/drcooldude/Desktop/testproject/env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  223.                 response = middleware_method(request, response)
File "/Users/drcooldude/Desktop/testproject/env/lib/python3.4/site-packages/htmlmin/middleware.py" in process_response
  44.                                            parser=parser)
File "/Users/drcooldude/Desktop/testproject/env/lib/python3.4/site-packages/htmlmin/minify.py" in html_minify
  43.     return unicode(mini_soup)

According to my traceback, the error is located in minify.py at line 43.

ghost commented 9 years ago

Found out that the error is because of incompatibility with Python 3. There is currently a pull request open that should fix it, but it's more than a year old: #72

ghost commented 9 years ago

Closing this, see #86