summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-23 09:24:14 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 10:26:19 -0400
commit7cb3a488436e8e7d0249280e95ba2ee945c96c87 (patch)
tree825256120b029107363fb59a5c705a4f995071da /django/forms/widgets.py
parent0e723ead5289f64d6fd648104c2aa741394060de (diff)
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 5c412dd8a724b263489c1bd7a2fea381460665d7.
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py8
1 files changed, 0 insertions, 8 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 13674e406b..365b7ba8c0 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -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):