Fixed #19401 - "swapped" is pre-calculated attribute #592

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

chmarr commented Dec 15, 2012

swapped was turned from a property to a attribute set during Option.contribute_to_class()

While we could put the entire comparison fix into _swapped(), this function started looking very process intensive and given that other parts of the code use this frequently as a "have I been swapped" check, I believe calculating this once and storing as an attribute is highly beneficial.

This differs from the previous pull request in that I do not have separate is_swapped, swapped_app_label and swapped_object_name attributes... instead leaving it as "swapped" in its original meaning.

Ie, the only change is that swapped is calculated once, with appropriate checking, rather than each time it is requested.

Fixed #19401 - "swapped" is pre-calculated attribute
swapped was turned from a property to a attribute set during Option.contribute_to_class()
Member

charettes commented Dec 17, 2012

Why not use the django.utils.functionnal.cached_property instead of property instead?

Owner

apollo13 commented Dec 30, 2012

Closing since the ticket is fixed…

@apollo13 apollo13 closed this Dec 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment