Fixed #24590 -- Cached calls to swappable_setting.

Moved the lookup in Field.swappable_setting to Apps, and added
an lru_cache to cache the results.

Refs #24743

Thanks Marten Kenbeek for the initial work on the patch. Thanks Aymeric
Augustin and Tim Graham for the review.
This commit is contained in:
Markus Holtermann 2015-08-22 23:40:34 +10:00
parent 91f701f4fc
commit e1427cc609
5 changed files with 56 additions and 29 deletions

View file

@ -396,7 +396,7 @@ class Options(object):
# or as part of validation.
return swapped_for
if '%s.%s' % (swapped_label, swapped_object.lower()) not in (None, self.label_lower):
if '%s.%s' % (swapped_label, swapped_object.lower()) != self.label_lower:
return swapped_for
return None