summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-13 19:15:50 -0500
committerDan McGee <dan@archlinux.org>2010-10-13 19:15:50 -0500
commit8973ee37c21ce0703244e07d60590a137ee16832 (patch)
tree3f9d567417a31ef0e692d4a3e38e884f37c3ce3f /mirrors
parent952ca5f349275cd7e80de945103c111ffe704d57 (diff)
Show all mirrors if no IP version specifiedrelease_2010-10-13
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>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index dcac6929..93007acb 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')