Commits

Alessandro Molina committed 711cc47

Cope with libsass returning both unicode or bytes depending on version

  • Participants
  • Parent commits c71c12d

Comments (0)

Files changed (1)

File tgext/scss/middleware.py

         response = Response()
         response.content_type = 'text/css'
         response.headers['ETag'] = etag_key
-        response.body = cached_data['content']
+        data = cached_data['content']
+
+        try:
+            response.text = data
+        except TypeError:
+            # Older versions of libsass returned response as bytes
+            # instead of unicode strings.
+            response.body = data
+
         return response(environ, start_response)