misc: use django handler for 404 pages (#30403)
This commit is contained in:
parent
9d04ffd779
commit
7a4de10ba3
|
@ -13,6 +13,7 @@ import pytest
|
|||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
from django.http import Http404
|
||||
from django.test import override_settings
|
||||
from quixote import cleanup
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
|
@ -113,13 +114,13 @@ def test_finish_interrupted_request():
|
|||
})
|
||||
response = pub.process_request(req)
|
||||
assert 'Invalid request: multipart/form-data missing boundary' in str(response)
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'PATH_INFO': '/gloubiboulga',
|
||||
})
|
||||
response = pub.process_request(req)
|
||||
assert '<p>The requested link' in str(response)
|
||||
with pytest.raises(Http404):
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'PATH_INFO': '/gloubiboulga',
|
||||
})
|
||||
response = pub.process_request(req)
|
||||
|
||||
def test_get_tenants():
|
||||
pub = create_temporary_pub()
|
||||
|
|
|
@ -173,6 +173,8 @@ class QommonPublisher(Publisher, object):
|
|||
if request.is_json():
|
||||
request.response.set_content_type('application/json')
|
||||
return json.dumps({'err': 1, 'err_class': exc.title, 'err_desc': exc.public_msg})
|
||||
if isinstance(exc, errors.TraversalError):
|
||||
raise Http404()
|
||||
output = self.format_publish_error(exc)
|
||||
self.session_manager.finish_successful_request()
|
||||
return output
|
||||
|
|
Loading…
Reference in New Issue