summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2018-01-01 20:39:02 +0100
committerJelle van der Waa <jelle@vdwaa.nl>2018-04-08 12:51:19 +0200
commita73e8d1a314b94ab927e82c307e04d77ef1d33e8 (patch)
tree07a6f2e157541822a71ac10628f8e71c85b343bd
parent98dab30f7fe9c24d889db5b3900d706c9df3c428 (diff)
downloadarchweb-a73e8d1a314b94ab927e82c307e04d77ef1d33e8.tar.gz
archweb-a73e8d1a314b94ab927e82c307e04d77ef1d33e8.zip
mirrorcheck: Update to Django 1.10
Use BaseCommand instead of the deprecated NoArgsCommand.
-rw-r--r--mirrors/management/commands/mirrorcheck.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py
index 1a33073a..9eaf38f1 100644
--- a/mirrors/management/commands/mirrorcheck.py
+++ b/mirrors/management/commands/mirrorcheck.py
@@ -14,7 +14,6 @@ from datetime import datetime
from httplib import HTTPException
import logging
import os
-from optparse import make_option
from pytz import utc
import re
import socket
@@ -28,7 +27,7 @@ import types
from Queue import Queue, Empty
import urllib2
-from django.core.management.base import NoArgsCommand
+from django.core.management.base import BaseCommand
from django.db import transaction
from django.utils.timezone import now
@@ -43,16 +42,23 @@ logging.basicConfig(
logger = logging.getLogger()
-class Command(NoArgsCommand):
- option_list = NoArgsCommand.option_list + (
- make_option('-t', '--timeout', dest='timeout', type='float', default=10.0,
- help='Timeout value for connecting to URL'),
- make_option('-l', '--location', dest='location', type='int',
- help='ID of CheckLocation object to use for this run'),
- )
+class Command(BaseCommand):
help = "Runs a check on all known mirror URLs to determine their up-to-date status."
- def handle_noargs(self, **options):
+ def add_arguments(self, parser):
+ parser.add_argument('-t',
+ '--timeout',
+ dest='timeout',
+ type=float,
+ default=10.0,
+ help='Timeout value for connecting to URL')
+ parser.add_argument('-l',
+ '--location',
+ dest='location',
+ type=int,
+ help='ID of CheckLocation object to use for this run')
+
+ def handle(self, **options):
v = int(options.get('verbosity', 0))
if v == 0:
logger.level = logging.ERROR