Fixed #15754 -- avoid recursively computing the tree of media widgets more times than is necessary for a wiget

This commit is contained in:
Alex Gaynor 2012-08-06 07:58:54 -07:00 committed by Alex Gaynor
parent ad237fb72f
commit ede49c7ee0
1 changed files with 4 additions and 3 deletions

View File

@ -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