summaryrefslogtreecommitdiff
path: root/mirrors/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-04-16 21:52:20 -0500
committerDan McGee <dan@archlinux.org>2013-04-16 21:52:20 -0500
commit0589853360d12a1746e2d8e92e798f2727a0b5df (patch)
tree348453f48cb384f6871c608a55d08ec223967088 /mirrors/views.py
parent1f126744417f40c1a27e8d53054b7bc588d12a00 (diff)
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>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r--mirrors/views.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index 9311fb8f..73d40297 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):