Fixed submission error handling and broken tests
- Fixed broken test_auth test - Fixed error handling on submission, it now raises the exception if it is not explicitly relevant to file submission.
This commit is contained in:
parent
eab23e38d0
commit
4601c30c2e
@ -73,7 +73,7 @@ def get_media_type_and_manager(filename):
|
||||
# Get the file extension
|
||||
ext = os.path.splitext(filename)[1].lower()
|
||||
else:
|
||||
raise Exception(
|
||||
raise InvalidFileType(
|
||||
_(u'Could not extract any file extension from "{filename}"').format(
|
||||
filename=filename))
|
||||
|
||||
|
@ -31,7 +31,8 @@ from mediagoblin.decorators import require_active_login
|
||||
from mediagoblin.submit import forms as submit_forms, security
|
||||
from mediagoblin.processing import mark_entry_failed, ProcessMedia
|
||||
from mediagoblin.messages import add_message, SUCCESS
|
||||
from mediagoblin.media_types import get_media_type_and_manager, InvalidFileType
|
||||
from mediagoblin.media_types import get_media_type_and_manager, \
|
||||
InvalidFileType, FileTypeNotSupported
|
||||
|
||||
|
||||
@require_active_login
|
||||
@ -133,8 +134,13 @@ def submit_start(request):
|
||||
This section is intended to catch exceptions raised in
|
||||
mediagobling.media_types
|
||||
'''
|
||||
submit_form.file.errors.append(
|
||||
e)
|
||||
|
||||
if isinstance(e, InvalidFileType) or \
|
||||
isinstance(e, FileTypeNotSupported):
|
||||
submit_form.file.errors.append(
|
||||
e)
|
||||
else:
|
||||
raise
|
||||
|
||||
return render_to_response(
|
||||
request,
|
||||
|
@ -233,9 +233,9 @@ def test_register_views(test_app):
|
||||
## Did we redirect to the proper page? Use the right template?
|
||||
assert_equal(
|
||||
urlparse.urlsplit(response.location)[2],
|
||||
'/auth/forgot_password/email_sent/')
|
||||
'/auth/login/')
|
||||
assert template.TEMPLATE_TEST_CONTEXT.has_key(
|
||||
'mediagoblin/auth/fp_email_sent.html')
|
||||
'mediagoblin/auth/login.html')
|
||||
|
||||
## Make sure link to change password is sent by email
|
||||
assert len(mail.EMAIL_TEST_INBOX) == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user