summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-14 02:15:50 +0200
committerDan McGee <dan@archlinux.org>2010-10-14 02:15:50 +0200
commit8973ee37c21ce0703244e07d60590a137ee16832 (patch)
tree3f9d567417a31ef0e692d4a3e38e884f37c3ce3f
parent952ca5f349275cd7e80de945103c111ffe704d57 (diff)
downloadarchweb-8973ee37c21ce0703244e07d60590a137ee16832.tar.gz
archweb-8973ee37c21ce0703244e07d60590a137ee16832.tar.xz
Show all mirrors if no IP version specified
I'm eating my words on this one- we don't want to filter to none() if we don't have an IP version specified, because people hitting the URL without a ip_version parameter would no longer get any mirrors back. Filter if they are provided by using a Q() object. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index dcac692..93007ac 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -62,12 +62,12 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False,
if countries and 'all' not in countries:
qset = qset.filter(mirror__country__in=countries)
- if ipv4_supported and not ipv6_supported:
- qset = qset.filter(has_ipv4=True)
- elif ipv6_supported and not ipv4_supported:
- qset = qset.filter(has_ipv6=True)
- elif not ipv4_supported and not ipv6_supported:
- qset = qset.none()
+ ip_version = Q()
+ if ipv4_supported:
+ ip_version |= Q(has_ipv4=True)
+ if ipv6_supported:
+ ip_version |= Q(has_ipv6=True)
+ qset = qset.filter(ip_version)
if not use_status:
urls = qset.order_by('mirror__country', 'mirror__name', 'url')