mirror of
https://github.com/django/django.git
synced 2025-07-23 13:15:32 +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:
parent
0e723ead52
commit
7cb3a48843
3 changed files with 13 additions and 27 deletions
|
@ -378,14 +378,6 @@ class ClearableFileInput(FileInput):
|
|||
"""
|
||||
Return whether value is considered to be initial value.
|
||||
"""
|
||||
# hasattr() masks exceptions on Python 2.
|
||||
if six.PY2:
|
||||
try:
|
||||
getattr(value, 'url')
|
||||
except AttributeError:
|
||||
return False
|
||||
else:
|
||||
return bool(value)
|
||||
return bool(value and hasattr(value, 'url'))
|
||||
|
||||
def get_template_substitution_values(self, value):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue