Skip to content

Fix SASS error display in CSS, change HTTP status to 200 (didn't display otherwise) #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
Version 0.8.1
-------------

To be released.
Released on May 14, 2015.

- Fixed a bug that there was no ``'expanded'`` in :const:`sass.OUTPUT_STYLES`
but ``'expected'`` instead which is a typo. [:issue:`66` by Triangle717]
Expand Down
10 changes: 5 additions & 5 deletions sassutils/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ class SassMiddleware(object):

"""

def __init__(self, app, manifests, package_dir={},
error_status='500 Internal Server Error'):
def __init__(self, app, manifests, package_dir={}):
if not callable(app):
raise TypeError('app must be a WSGI-compliant callable object, '
'not ' + repr(app))
Expand All @@ -101,7 +100,6 @@ def __init__(self, app, manifests, package_dir={},
if not isinstance(package_dir, collections.Mapping):
raise TypeError('package_dir must be a mapping object, not ' +
repr(package_dir))
self.error_status = error_status
self.package_dir = dict(package_dir)
for package_name in self.manifests:
if package_name in self.package_dir:
Expand Down Expand Up @@ -136,14 +134,16 @@ def __call__(self, environ, start_response):
logger = logging.getLogger(__name__ + '.SassMiddleware')
logger.error(str(e))
start_response(
self.error_status,
"200 OK",
[('Content-Type', 'text/css; charset=utf-8')]
)
return [
b'/*\n', str(e).encode('utf-8'), b'\n*/\n\n',
b'body:before { content: ',
self.quote_css_string(str(e)).encode('utf-8'),
b'; color: maroon; background-color: white; }'
b'; color: maroon; background-color: white',
b'; white-space: pre-wrap; display: block; ',
b'font-family: "Courier New"; user-select: text; }'
]

def read_file(path):
Expand Down