diff options
author | Dan McGee <dan@archlinux.org> | 2013-04-17 04:52:20 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-04-17 04:52:20 +0200 |
commit | 0589853360d12a1746e2d8e92e798f2727a0b5df (patch) | |
tree | 348453f48cb384f6871c608a55d08ec223967088 | |
parent | 1f126744417f40c1a27e8d53054b7bc588d12a00 (diff) | |
download | archweb-0589853360d12a1746e2d8e92e798f2727a0b5df.tar.gz archweb-0589853360d12a1746e2d8e92e798f2727a0b5df.tar.xz |
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 <dan@archlinux.org>
-rw-r--r-- | mirrors/views.py | 6 |
1 files 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): |