From 0589853360d12a1746e2d8e92e798f2727a0b5df Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 16 Apr 2013 21:52:20 -0500 Subject: Remove COUNTRY_LOOKUP global variable This is only used in one place, so it makes more sense for it to not be globally accessible. Signed-off-by: Dan McGee --- mirrors/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mirrors/views.py b/mirrors/views.py index 9311fb8..73d4029 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -17,8 +17,6 @@ from .models import (Mirror, MirrorUrl, MirrorProtocol, MirrorLog, CheckLocation) from .utils import get_mirror_statuses, get_mirror_errors, DEFAULT_CUTOFF -COUNTRY_LOOKUP = dict(COUNTRIES) - class MirrorlistForm(forms.Form): country = forms.MultipleChoiceField(required=False) @@ -29,6 +27,8 @@ class MirrorlistForm(forms.Form): widget=CheckboxSelectMultiple) use_mirror_status = forms.BooleanField(required=False) + countries = dict(COUNTRIES) + def __init__(self, *args, **kwargs): super(MirrorlistForm, self).__init__(*args, **kwargs) fields = self.fields @@ -46,7 +46,7 @@ class MirrorlistForm(forms.Form): country_codes.update(MirrorUrl.objects.filter( mirror__active=True).exclude(country='').values_list( 'country', flat=True).order_by().distinct()) - countries = [(code, COUNTRY_LOOKUP[code]) for code in country_codes] + countries = [(code, self.countries[code]) for code in country_codes] return sorted(countries, key=itemgetter(1)) def as_div(self): -- cgit v1.2.3-24-g4f1b