[dreamwidth/dreamwidth] d71f90: more generic fix for legacy country codes (#3031)
Branch: refs/heads/main Home: https://github.com/dreamwidth/dreamwidth Commit: d71f904220f91cfbbb497d29cb885b691290bd67 https://github.com/dreamwidth/dreamwidth/commit/d71f904220f91cfbbb497d29cb885b691290bd67 Author: Jen kareila@dreamwidth.org Date: 2022-11-22 (Tue, 22 Nov 2022)
Changed paths: M cgi-bin/DW/Controller/Shop/CreditCard.pm M cgi-bin/DW/Controller/Stats.pm M cgi-bin/DW/Countries.pm M cgi-bin/DW/Logic/ProfilePage.pm M cgi-bin/LJ/Widget/Location.pm
Log Message:
more generic fix for legacy country codes (#3031)
Years ago, we changed our source of country code data to use a standard CPAN module. This has largely worked well except for a couple of odd corner cases where the previous country code stored in user data didn't match up with the new source. The obvious one was the change from UK to GB, so we kludged in recognition for both codes, and then deleted the older one anywhere it showed up as a duplicate in a drop down menu.
Subsequently it was noted that there was a legacy code for Scotland (LJSC) which needed the same treatment. Instead of continuing to expand the kludge, this adds a second class method, load_legacy, to use when requesting the version of the data that includes the older codes. That way we can go back to calling the basic load method without having to then delete the extra codes in the caller. And if we stumble across any other missing codes, they'll be maintained in one place.
Fixes #2197.