diff options
author | Dan McGee <dan@archlinux.org> | 2012-04-24 23:22:23 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-04-25 00:00:36 -0500 |
commit | 116751e4bab183b3cca93ab13f7f4f21c752be4e (patch) | |
tree | 4eff5a95519b85352e92516f33bf1897dc90a8a8 /mirrors/utils.py | |
parent | 206000df736fde75a49c3178a8522d17f30a955e (diff) |
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 <dan@archlinux.org>
Diffstat (limited to 'mirrors/utils.py')
-rw-r--r-- | mirrors/utils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py index ddecb095..aa1e9f76 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: |