summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-25 01:32:57 -0500
committerDan McGee <dan@archlinux.org>2012-04-25 01:51:58 -0500
commit640e0f58645a7fd07f3c6185d9583b4d218e2468 (patch)
tree46323cbe3549b7d60a7b88eacb702522982b2a27
parent20675141c340ea3d2d6d8305f8ba0950d3bf974c (diff)
Finish django countries implementation
* Add a migration to drop the old countries field. * Update all templates/views/utility methods to point at the new country field and dereference it as necessary. * Add the flags images to a few views where it makes sense. * Cleanup the download page layout quite a bit. * Bump the mirror status JSON version to 3; add country_code attribute. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py76
-rw-r--r--mirrors/models.py9
-rw-r--r--mirrors/utils.py17
-rw-r--r--mirrors/views.py62
-rw-r--r--public/views.py18
-rw-r--r--sitestatic/archweb.css19
-rw-r--r--templates/mirrors/mirror_details.html2
-rw-r--r--templates/mirrors/mirrorlist.txt2
-rw-r--r--templates/mirrors/mirrorlist_status.txt3
-rw-r--r--templates/mirrors/mirrors.html16
-rw-r--r--templates/mirrors/status.html2
-rw-r--r--templates/mirrors/status_table.html2
-rw-r--r--templates/public/download.html43
13 files changed, 168 insertions, 103 deletions
diff --git a/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py b/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py
new file mode 100644
index 00000000..ae917ec0
--- /dev/null
+++ b/mirrors/migrations/0016_auto__del_field_mirror_country_old__del_field_mirrorurl_country_old.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ db.delete_column('mirrors_mirror', 'country_old')
+ db.delete_column('mirrors_mirrorurl', 'country_old')
+ db.create_index('mirrors_mirror', ['country'])
+ db.create_index('mirrors_mirrorurl', ['country'])
+
+ def backwards(self, orm):
+ db.delete_index('mirrors_mirrorurl', ['country'])
+ db.delete_index('mirrors_mirror', ['country'])
+ db.add_column('mirrors_mirror', 'country_old',
+ self.gf('django.db.models.fields.CharField')(default='Any', max_length=255, db_index=True),
+ keep_default=False)
+ db.add_column('mirrors_mirrorurl', 'country_old',
+ self.gf('mirrors.models.NullCharField')(blank=True, max_length=255, null=True, db_index=True),
+ keep_default=False)
+
+ models = {
+ 'mirrors.mirror': {
+ 'Meta': {'ordering': "('country', 'name')", 'object_name': 'Mirror'},
+ 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'admin_email': ('django.db.models.fields.EmailField', [], {'max_length': '255', 'blank': 'True'}),
+ 'country': ('django_countries.fields.CountryField', [], {'db_index': 'True', 'max_length': '2', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'isos': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'notes': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'rsync_password': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
+ 'rsync_user': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
+ 'tier': ('django.db.models.fields.SmallIntegerField', [], {'default': '2'}),
+ 'upstream': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mirrors.Mirror']", 'null': 'True', 'on_delete': 'models.SET_NULL'})
+ },
+ 'mirrors.mirrorlog': {
+ 'Meta': {'object_name': 'MirrorLog'},
+ 'check_time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
+ 'duration': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
+ 'error': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_success': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'last_sync': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'url': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'logs'", 'to': "orm['mirrors.MirrorUrl']"})
+ },
+ 'mirrors.mirrorprotocol': {
+ 'Meta': {'ordering': "('protocol',)", 'object_name': 'MirrorProtocol'},
+ 'default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_download': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'protocol': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'})
+ },
+ 'mirrors.mirrorrsync': {
+ 'Meta': {'object_name': 'MirrorRsync'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ip': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
+ 'mirror': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'rsync_ips'", 'to': "orm['mirrors.Mirror']"})
+ },
+ 'mirrors.mirrorurl': {
+ 'Meta': {'object_name': 'MirrorUrl'},
+ 'country': ('django_countries.fields.CountryField', [], {'db_index': 'True', 'max_length': '2', 'blank': 'True'}),
+ 'has_ipv4': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'has_ipv6': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'mirror': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'urls'", 'to': "orm['mirrors.Mirror']"}),
+ 'protocol': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'urls'", 'on_delete': 'models.PROTECT', 'to': "orm['mirrors.MirrorProtocol']"}),
+ 'url': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
+ }
+ }
+
+ complete_apps = ['mirrors']
diff --git a/mirrors/models.py b/mirrors/models.py
index 79968412..c23622fa 100644
--- a/mirrors/models.py
+++ b/mirrors/models.py
@@ -25,8 +25,7 @@ class Mirror(models.Model):
name = models.CharField(max_length=255, unique=True)
tier = models.SmallIntegerField(default=2, choices=TIER_CHOICES)
upstream = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
- country_old = models.CharField(max_length=255, db_index=True)
- country = CountryField(blank=True)
+ country = CountryField(blank=True, db_index=True)
admin_email = models.EmailField(max_length=255, blank=True)
public = models.BooleanField(default=True)
active = models.BooleanField(default=True)
@@ -70,9 +69,7 @@ class MirrorUrl(models.Model):
protocol = models.ForeignKey(MirrorProtocol, related_name="urls",
editable=False, on_delete=models.PROTECT)
mirror = models.ForeignKey(Mirror, related_name="urls")
- country_old = NullCharField(max_length=255, null=True, blank=True,
- db_index=True)
- country = CountryField(blank=True)
+ country = CountryField(blank=True, db_index=True)
has_ipv4 = models.BooleanField("IPv4 capable", default=True,
editable=False)
has_ipv6 = models.BooleanField("IPv6 capable", default=False,
@@ -90,7 +87,7 @@ class MirrorUrl(models.Model):
@property
def real_country(self):
- return self.country_old or self.mirror.country_old
+ return self.country or self.mirror.country
def clean(self):
try:
diff --git a/mirrors/utils.py b/mirrors/utils.py
index aa1e9f76..728c3040 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -1,6 +1,7 @@
from datetime import timedelta
from django.db.models import Avg, Count, Max, Min, StdDev
+from django_countries.fields import Country
from main.utils import cache_function, utc_now
from .models import MirrorLog, MirrorProtocol, MirrorUrl
@@ -89,13 +90,14 @@ def get_mirror_errors(cutoff=default_cutoff):
errors = MirrorLog.objects.filter(
is_success=False, check_time__gte=cutoff_time,
url__mirror__active=True, url__mirror__public=True).values(
- 'url__url', 'url__country_old', 'url__protocol__protocol',
- 'url__mirror__country_old', 'error').annotate(
+ 'url__url', 'url__country', 'url__protocol__protocol',
+ 'url__mirror__country', 'error').annotate(
error_count=Count('error'), last_occurred=Max('check_time')
).order_by('-last_occurred', '-error_count')
errors = list(errors)
for err in errors:
- err['country'] = err['url__country_old'] or err['url__mirror__country_old']
+ ctry_code = err['url__country'] or err['url__mirror__country']
+ err['country'] = Country(ctry_code)
return errors
@@ -114,16 +116,15 @@ def get_mirror_url_for_download(cutoff=default_cutoff):
best_logs = MirrorLog.objects.filter(is_success=True,
check_time__gte=min_check_time, last_sync__gte=min_sync_time,
url__mirror__public=True, url__mirror__active=True,
- url__protocol__protocol__iexact='HTTP').order_by(
+ url__protocol__default=True).order_by(
'duration')[:1]
if best_logs:
return MirrorUrl.objects.get(id=best_logs[0].url_id)
mirror_urls = MirrorUrl.objects.filter(
- mirror__public=True, mirror__active=True,
- protocol__protocol__iexact='HTTP')
- # look first for an 'Any' URL, then fall back to any HTTP URL
- filtered_urls = mirror_urls.filter(mirror__country_old='Any')[:1]
+ mirror__public=True, mirror__active=True, protocol__default=True)
+ # look first for a country-agnostic URL, then fall back to any HTTP URL
+ filtered_urls = mirror_urls.filter(mirror__country='')[:1]
if not filtered_urls:
filtered_urls = mirror_urls[:1]
if not filtered_urls:
diff --git a/mirrors/views.py b/mirrors/views.py
index c5989d67..349c17d1 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -1,3 +1,6 @@
+import datetime
+from operator import attrgetter, itemgetter
+
from django import forms
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Q
@@ -6,12 +9,13 @@ from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.simple import direct_to_template
from django.utils import simplejson
+from django_countries.countries import COUNTRIES
-from main.utils import make_choice
from .models import Mirror, MirrorUrl, MirrorProtocol
from .utils import get_mirror_statuses, get_mirror_errors
-import datetime
+COUNTRY_LOOKUP = dict(COUNTRIES)
+
class MirrorlistForm(forms.Form):
country = forms.MultipleChoiceField(required=False)
@@ -22,17 +26,27 @@ class MirrorlistForm(forms.Form):
def __init__(self, *args, **kwargs):
super(MirrorlistForm, self).__init__(*args, **kwargs)
- countries = Mirror.objects.filter(active=True).values_list(
- 'country_old', flat=True).distinct().order_by('country_old')
- self.fields['country'].choices = [('all','All')] + make_choice(
- countries)
- self.fields['country'].initial = ['all']
- protos = make_choice(
- MirrorProtocol.objects.filter(is_download=True))
+ fields = self.fields
+ fields['country'].choices = [('all','All')] + self.get_countries()
+ fields['country'].initial = ['all']
+ protos = [(p.protocol, p.protocol) for p in
+ MirrorProtocol.objects.filter(is_download=True)]
initial = MirrorProtocol.objects.filter(is_download=True, default=True)
- self.fields['protocol'].choices = protos
- self.fields['protocol'].initial = [p.protocol for p in initial]
- self.fields['ip_version'].initial = ['4']
+ fields['protocol'].choices = protos
+ fields['protocol'].initial = [p.protocol for p in initial]
+ fields['ip_version'].initial = ['4']
+
+ def get_countries(self):
+ country_codes = set()
+ country_codes.update(Mirror.objects.filter(active=True).exclude(
+ country='').values_list(
+ 'country', flat=True).order_by().distinct())
+ 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]
+ return sorted(countries, key=itemgetter(1))
+
@csrf_exempt
def generate_mirrorlist(request):
@@ -52,6 +66,7 @@ def generate_mirrorlist(request):
return direct_to_template(request, 'mirrors/index.html',
{'mirrorlist_form': form})
+
def find_mirrors(request, countries=None, protocols=None, use_status=False,
ipv4_supported=True, ipv6_supported=True):
if not protocols:
@@ -62,8 +77,8 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False,
mirror__public=True, mirror__active=True,
)
if countries and 'all' not in countries:
- qset = qset.filter(Q(country_old__in=countries) |
- Q(mirror__country_old__in=countries))
+ qset = qset.filter(Q(country__in=countries) |
+ Q(mirror__country__in=countries))
ip_version = Q()
if ipv4_supported:
@@ -74,7 +89,7 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False,
if not use_status:
urls = qset.order_by('mirror__name', 'url')
- urls = sorted(urls, key=lambda x: x.real_country)
+ urls = sorted(urls, key=attrgetter('real_country'))
template = 'mirrors/mirrorlist.txt'
else:
status_info = get_mirror_statuses()
@@ -96,13 +111,15 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False,
},
mimetype='text/plain')
+
def mirrors(request):
- mirror_list = Mirror.objects.select_related().order_by('tier', 'country_old')
+ mirror_list = Mirror.objects.select_related().order_by('tier', 'country')
if not request.user.is_authenticated():
mirror_list = mirror_list.filter(public=True, active=True)
return direct_to_template(request, 'mirrors/mirrors.html',
{'mirror_list': mirror_list})
+
def mirror_details(request, name):
mirror = get_object_or_404(Mirror, name=name)
if not request.user.is_authenticated() and \
@@ -116,11 +133,12 @@ def mirror_details(request, name):
# get each item from checked_urls and supplement with anything in all_urls
# if it wasn't there
all_urls = set(checked_urls).union(all_urls)
- all_urls = sorted(all_urls, key=lambda x: x.url)
+ all_urls = sorted(all_urls, key=attrgetter('url'))
return direct_to_template(request, 'mirrors/mirror_details.html',
{'mirror': mirror, 'urls': all_urls})
+
def status(request):
bad_timedelta = datetime.timedelta(days=3)
status_info = get_mirror_statuses()
@@ -143,6 +161,7 @@ def status(request):
})
return direct_to_template(request, 'mirrors/status.html', context)
+
class MirrorStatusJSONEncoder(DjangoJSONEncoder):
'''Base JSONEncoder extended to handle datetime.timedelta and MirrorUrl
serialization. The base class takes care of datetime.datetime types.'''
@@ -159,17 +178,20 @@ class MirrorStatusJSONEncoder(DjangoJSONEncoder):
if isinstance(obj, MirrorUrl):
data = dict((attr, getattr(obj, attr))
for attr in self.url_attributes)
- # separate because it isn't on the URL directly
- data['country'] = obj.real_country
+ # get any override on the country attribute first
+ country = obj.real_country
+ data['country'] = unicode(country.name)
+ data['country_code'] = country.code
return data
if isinstance(obj, MirrorProtocol):
return unicode(obj)
return super(MirrorStatusJSONEncoder, self).default(obj)
+
def status_json(request):
status_info = get_mirror_statuses()
data = status_info.copy()
- data['version'] = 2
+ data['version'] = 3
to_json = simplejson.dumps(data, ensure_ascii=False,
cls=MirrorStatusJSONEncoder)
response = HttpResponse(to_json, mimetype='application/json')
diff --git a/public/views.py b/public/views.py
index e149d921..3ea8f841 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,11 +1,11 @@
from datetime import datetime
+from operator import attrgetter
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import Count, Q
from django.http import Http404
from django.views.decorators.cache import cache_control
-from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
from devel.models import MasterKey, PGPSignature
@@ -66,19 +66,17 @@ def donate(request):
@cache_control(max_age=300)
def download(request):
- qset = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
- protocol__is_download=True,
- mirror__public=True, mirror__active=True, mirror__isos=True
- )
+ mirror_urls = MirrorUrl.objects.select_related('mirror').filter(
+ protocol__default=True,
+ mirror__public=True, mirror__active=True, mirror__isos=True)
+ sort_by = attrgetter('real_country.name', 'mirror.name')
+ mirror_urls = sorted(mirror_urls, key=sort_by)
context = {
'releng_iso_url': settings.ISO_LIST_URL,
'releng_pxeboot_url': settings.PXEBOOT_URL,
+ 'mirror_urls': mirror_urls,
}
- return list_detail.object_list(request,
- qset.order_by('mirror__country_old', 'mirror__name', 'protocol'),
- template_name="public/download.html",
- template_object_name="mirror_url",
- extra_context=context)
+ return direct_to_template(request, 'public/download.html', context)
@cache_control(max_age=300)
def feeds(request):
diff --git a/sitestatic/archweb.css b/sitestatic/archweb.css
index a7fe6cac..1df05071 100644
--- a/sitestatic/archweb.css
+++ b/sitestatic/archweb.css
@@ -588,25 +588,6 @@ table#download-torrents .cpu-arch {
text-align: center;
}
-table#download-mirrors {
- width: auto;
- margin-bottom: 1em;
-}
-
- table#download-mirrors td.mirror-country {
- padding-top: 1em;
- }
-
- table#download-mirrors td.mirror-server {
- padding-right: 1em;
- }
-
- table#download-mirrors a {
- display: block;
- float: right;
- width: 4em;
- }
-
/* pkglists/devlists */
table.results {
font-size: 0.846em;
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html
index bb3b417c..6fe68f36 100644
--- a/templates/mirrors/mirror_details.html
+++ b/templates/mirrors/mirror_details.html
@@ -21,7 +21,7 @@
</tr>
<tr>
<th>Country:</th>
- <td>{{ mirror.country_old }}</td>
+ <td>{{ mirror.country.name|default:'Worldwide' }}</td>
</tr>
<tr>
<th>Has ISOs:</th>
diff --git a/templates/mirrors/mirrorlist.txt b/templates/mirrors/mirrorlist.txt
index 24b52fa1..d3dd6e4e 100644
--- a/templates/mirrors/mirrorlist.txt
+++ b/templates/mirrors/mirrorlist.txt
@@ -8,6 +8,6 @@ content right, and then go back later to fix it all up.
## Generated on {% now "Y-m-d" %}
##{% for mirror_url in mirror_urls %}{% ifchanged %}
-## {{ mirror_url.real_country }}{% endifchanged %}
+## {{ mirror_url.real_country.name|default:'Worldwide' }}{% endifchanged %}
#Server = {{ mirror_url.url}}$repo/os/$arch{% endfor %}
{% endautoescape %}
diff --git a/templates/mirrors/mirrorlist_status.txt b/templates/mirrors/mirrorlist_status.txt
index e3504395..523794b2 100644
--- a/templates/mirrors/mirrorlist_status.txt
+++ b/templates/mirrors/mirrorlist_status.txt
@@ -7,7 +7,8 @@ content right, and then go back later to fix it all up.
## Arch Linux repository mirrorlist
## Sorted by mirror score from mirror status page
## Generated on {% now "Y-m-d" %}
+##
{% for mirror_url in mirror_urls %}
-## Score: {{ mirror_url.score|floatformat:1|default:'unknown' }}, {{ mirror_url.real_country }}
+## Score: {{ mirror_url.score|floatformat:1|default:'unknown' }}, {{ mirror_url.real_country.name|default:'Worldwide' }}
#Server = {{ mirror_url.url}}$repo/os/$arch{% endfor %}
{% endautoescape %}
diff --git a/templates/mirrors/mirrors.html b/templates/mirrors/mirrors.html
index 4b59058a..19c6ea27 100644
--- a/templates/mirrors/mirrors.html
+++ b/templates/mirrors/mirrors.html
@@ -26,15 +26,15 @@
<tr class="{% cycle 'odd' 'even' %}">
<td><a href="{{ mirror.get_absolute_url }}"
title="Mirror details for {{ mirror.name }}">{{ mirror.name }}</a></td>
- <td>{{mirror.get_tier_display}}</td>
- <td>{{mirror.country_old}}</td>
- <td>{{mirror.isos|yesno|capfirst}}</td>
- <td class="wrap">{{mirror.supported_protocols|join:", "}}</td>
+ <td>{{ mirror.get_tier_display }}</td>
+ <td>{% if mirror.country %}<img src="{{ mirror.country.flag }}"/> {% endif %}{{ mirror.country.name }}</td>
+ <td>{{ mirror.isos|yesno|capfirst }}</td>
+ <td class="wrap">{{ mirror.supported_protocols|join:", " }}</td>
{% if user.is_authenticated %}
- <td>{{mirror.public|yesno|capfirst}}</td>
- <td>{{mirror.active|yesno|capfirst}}</td>
- <td>{{mirror.admin_email}}</td>
- <td class="wrap">{{mirror.notes|linebreaks}}</td>
+ <td>{{ mirror.public|yesno|capfirst }}</td>
+ <td>{{ mirror.active|yesno|capfirst }}</td>
+ <td>{{ mirror.admin_email }}</td>
+ <td class="wrap">{{ mirror.notes|linebreaks }}</td>
{% endif %}
</tr>
{% endfor %}
diff --git a/templates/mirrors/status.html b/templates/mirrors/status.html
index 225572ee..8f814448 100644
--- a/templates/mirrors/status.html
+++ b/templates/mirrors/status.html
@@ -92,7 +92,7 @@
{% spaceless %}<tr class="{% cycle 'odd' 'even' %}">
<td>{{ log.url__url }}</td>
<td>{{ log.url__protocol__protocol }}</td>
- <td>{{ log.country }}</td>
+ <td>{% if log.country %}<img src="{{ log.country.flag }}"/> {% endif %}{{ log.country.name }}</td>
<td>{{ log.error }}</td>
<td>{{ log.last_occurred|date:'Y-m-d H:i' }}</td>
<td>{{ log.error_count }}</td>
diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html
index bd70115c..3a20c068 100644
--- a/templates/mirrors/status_table.html
+++ b/templates/mirrors/status_table.html
@@ -18,7 +18,7 @@
{% spaceless %}<tr class="{% cycle 'odd' 'even' %}">
<td>{{ m_url.url }}</td>
<td>{{ m_url.protocol }}</td>
- <td>{{ m_url.real_country }}</td>
+ <td>{% if m_url.real_country %}<img src="{{ m_url.real_country.flag }}"/> {% endif %}{{ m_url.real_country.name }}</td>
<td>{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }}</td>
<td>{{ m_url.completion_pct|percentage:1 }}</td>
<td>{{ m_url.delay|duration|default:'unknown' }}</td>
diff --git a/templates/public/download.html b/templates/public/download.html
index fbadb7c0..4d75268a 100644
--- a/templates/public/download.html
+++ b/templates/public/download.html
@@ -77,7 +77,7 @@
<a href="https://www.archlinux.org/iso/{{version}}/archlinux-{{version}}-netinstall-dual.iso.torrent"
title="Download for both architectures">Download</a>
</td><td class="wrap">
- Downloads and installs packages versions via FTP for absolute freshness.
+ Downloads and installs packages versions via mirrors for absolute freshness.
</td>
</tr><tr>
<td>
@@ -131,10 +131,10 @@
title="Release Engineering ISO feedback">Feedback</a></li>
</ul>
- <h3>HTTP/FTP Direct Downloads</h3>
+ <h3>HTTP Direct Downloads</h3>
<p>In addition to the BitTorrent links above, install images can also be
- downloaded via HTTP or FTP from the mirror sites listed below. Please
+ downloaded via HTTP from the mirror sites listed below. Please
ensure the download image matches the checksum from the md5sums.txt or
sha1sums.txt file in the same directory as the image.</p>
@@ -150,30 +150,19 @@
</ul>
{% cache 600 download-mirrors %}
- <table id="download-mirrors">
- <thead>
- <tr>
- <th><h4>Server Location</h4></th>
- <th><h4>Download</h4></th>
- </tr>
- </thead>
- <tbody>
- <tr><td colspan="2">
- {% for mirror_url in mirror_url_list %}
- {% ifchanged mirror_url.mirror.country_old %}
- </td></tr>
- <tr><td class="mirror-country" colspan="2"><strong>{{mirror_url.mirror.country_old}}</strong>
- {% endifchanged %}
- {% ifchanged mirror_url.mirror.name %}
- </td></tr>
- <tr><td class="mirror-server">{{mirror_url.mirror.name}}</td><td>
- {% endifchanged %}
- <a href="{{mirror_url.url}}iso/{{ version }}/"
- title="Download from {{mirror_url.url}}">{{mirror_url.protocol.protocol|upper}}</a>
- {% endfor %}
- </td></tr>
- </tbody>
- </table>
+ <div id="download-mirrors">
+ {% regroup mirror_urls by real_country as grouped_urls %}
+ {% for country in grouped_urls %}
+ {% if country.grouper %}<h5><img src="{{ country.grouper.flag }}"/> {{ country.grouper.name }}</h5>
+ {% else %}<h5>Worldwide</h5>{% endif %}
+ <ul>
+ {% for mirror_url in country.list %}
+ <li><a href="{{ mirror_url.url }}iso/{{ version }}/"
+ title="Download from {{ mirror_url.url }}iso/{{ version }}/">{{ mirror_url.mirror.name }}</a></li>
+ {% endfor %}
+ </ul>
+ {% endfor %}
+ </div>
{% endcache %}
{% endwith %}