Ensure only active mirror URLs are listed

This fixes things up on the download page as well as the individual
mirror details page.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2013-06-01 09:21:42 -05:00
parent 31bc66e23c
commit 49bf498879
3 changed files with 3 additions and 2 deletions

View File

@ -116,6 +116,7 @@ def __unicode__(self):
class Meta:
verbose_name = 'mirror rsync IP'
ordering = ('ip',)
class CheckLocation(models.Model):

View File

@ -161,7 +161,7 @@ def mirror_details(request, name):
status_info = get_mirror_statuses(mirror_id=mirror.id)
checked_urls = {url for url in status_info['urls'] \
if url.mirror_id == mirror.id}
all_urls = set(mirror.urls.select_related('protocol'))
all_urls = set(mirror.urls.filter(active=True).select_related('protocol'))
# Add dummy data for URLs that we haven't checked recently
other_urls = all_urls.difference(checked_urls)
for url in other_urls:

View File

@ -80,7 +80,7 @@ def _mirror_urls():
'''In order to ensure this is lazily evaluated since we can't do
sorting at the database level, make it a callable.'''
urls = MirrorUrl.objects.select_related('mirror').filter(
protocol__default=True,
active=True, protocol__default=True,
mirror__public=True, mirror__active=True, mirror__isos=True)
sort_by = attrgetter('country.name', 'mirror.name')
return sorted(urls, key=sort_by)