From 116751e4bab183b3cca93ab13f7f4f21c752be4e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 24 Apr 2012 23:22:23 -0500 Subject: Rename mirror country fields to country_old in prep for normalization We're going to move to using ISO 2 character codes via django countries, so start by moving the old data out of the way first. Signed-off-by: Dan McGee --- mirrors/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mirrors/utils.py') diff --git a/mirrors/utils.py b/mirrors/utils.py index ddecb09..aa1e9f7 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -89,13 +89,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__country', 'url__protocol__protocol', - 'url__mirror__country', 'error').annotate( + 'url__url', 'url__country_old', 'url__protocol__protocol', + 'url__mirror__country_old', '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'] or err['url__mirror__country'] + err['country'] = err['url__country_old'] or err['url__mirror__country_old'] return errors @@ -123,7 +123,7 @@ def get_mirror_url_for_download(cutoff=default_cutoff): 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='Any')[:1] + filtered_urls = mirror_urls.filter(mirror__country_old='Any')[:1] if not filtered_urls: filtered_urls = mirror_urls[:1] if not filtered_urls: -- cgit v1.2.3-24-g4f1b