summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2012-08-06 07:58:54 -0700
committerAlex Gaynor <alex.gaynor@rd.io>2012-08-06 07:59:59 -0700
commitede49c7ee03dd1519d0c375d953cb73e106837b6 (patch)
tree1d293f906597e6ede914237de49500c4bb993d50 /django/forms/widgets.py
parentad237fb72f769bbd99b5ed6e3292bead614e1c94 (diff)
Fixed #15754 -- avoid recursively computing the tree of media widgets more times than is necessary for a wiget
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 6b1be37ec2..3c4da2444d 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -110,9 +110,10 @@ class Media(StrAndUnicode):
def media_property(cls):
def _media(self):
# Get the media property of the superclass, if it exists
- if hasattr(super(cls, self), 'media'):
- base = super(cls, self).media
- else:
+ sup_cls = super(cls, self)
+ try:
+ base = sup_cls.media
+ except AttributeError:
base = Media()
# Get the media definition for this class