diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-12 18:36:20 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-12 18:36:20 -0500 |
commit | 78a553e558217640c0efa233ac7a7037be3f34b5 (patch) | |
tree | dc042ef4ab8d52e93250e7d6b3a36b477cb86182 /mirrors/utils.py | |
parent | 064813560c20f53f9fd759d0c4e0f0a6729c8ba6 (diff) |
Add optional country override for individual mirror URLs
This allows a named top-level mirror to have geographically distributed
URLs, e.g. kernel.org and the geo-DNS setup.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/utils.py')
-rw-r--r-- | mirrors/utils.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py index 124b66e6..2d88f125 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -82,10 +82,13 @@ 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__protocol__protocol', 'url__mirror__country', - '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') - return list(errors) + errors = list(errors) + for err in errors: + err['country'] = err['url__country'] or err['url__mirror__country'] + return errors # vim: set ts=4 sw=4 et: |