1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #25410 -- Fixed empty ClearableFileInput crash on Python 2.

Reverted "Fixes #24727 -- Prevented ClearableFileInput from masking
exceptions on Python 2" and added a regression test.

This reverts commit 5c412dd8a7.
This commit is contained in:
Tim Graham
2015-09-23 09:24:14 -04:00
parent 0e723ead52
commit 7cb3a48843
3 changed files with 13 additions and 27 deletions

View File

@@ -57,25 +57,6 @@ class ClearableFileInputTest(WidgetTest):
self.assertIn('my<div>file', output)
self.assertNotIn('my<div>file', output)
def test_html_does_not_mask_exceptions(self):
"""
A ClearableFileInput should not mask exceptions produced while
checking that it has a value.
"""
@python_2_unicode_compatible
class FailingURLFieldFile(object):
@property
def url(self):
raise RuntimeError('Canary')
def __str__(self):
return 'value'
widget = ClearableFileInput()
field = FailingURLFieldFile()
with self.assertRaisesMessage(RuntimeError, 'Canary'):
widget.render('myfile', field)
def test_clear_input_renders_only_if_not_required(self):
"""
A ClearableFileInput with is_required=False does not render a clear