Commit 0d8cfb9b by Christina Roberts

Merge pull request #1437 from MITx/fix/cdodge/static-content-server-return-404

change from throwing a Http404 exception, which I believe will try to re...
parents b68aff72 3fa1fe0c
...@@ -515,6 +515,9 @@ class ContentStoreTest(TestCase): ...@@ -515,6 +515,9 @@ class ContentStoreTest(TestCase):
# note, we know the link it should be because that's what in the 'full' course in the test data # note, we know the link it should be because that's what in the 'full' course in the test data
self.assertContains(resp, '/c4x/edX/full/asset/handouts_schematic_tutorial.pdf') self.assertContains(resp, '/c4x/edX/full/asset/handouts_schematic_tutorial.pdf')
def test_missing_static_content(self):
resp = self.client.get("/c4x/asd/asd/asd/asd")
self.assertEqual(resp.status_code, 404)
def test_capa_module(self): def test_capa_module(self):
"""Test that a problem treats markdown specially.""" """Test that a problem treats markdown specially."""
......
...@@ -21,7 +21,9 @@ class StaticContentServer(object): ...@@ -21,7 +21,9 @@ class StaticContentServer(object):
try: try:
content = contentstore().find(loc) content = contentstore().find(loc)
except NotFoundError: except NotFoundError:
raise Http404 response = HttpResponse()
response.status_code = 404
return response
# since we fetched it from DB, let's cache it going forward # since we fetched it from DB, let's cache it going forward
set_cached_content(content) set_cached_content(content)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment