From 7cb3a488436e8e7d0249280e95ba2ee945c96c87 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 23 Sep 2015 09:24:14 -0400 Subject: 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. --- django/forms/widgets.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'django/forms') 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): -- cgit v1.3