Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jelle van der Waa
Archweb
Commits
a73e8d1a
Commit
a73e8d1a
authored
Jan 01, 2018
by
Jelle van der Waa
🚧
Browse files
mirrorcheck: Update to Django 1.10
Use BaseCommand instead of the deprecated NoArgsCommand.
parent
98dab30f
Changes
1
Hide whitespace changes
Inline
Side-by-side
mirrors/management/commands/mirrorcheck.py
View file @
a73e8d1a
...
...
@@ -14,7 +14,6 @@
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 @@
from
Queue
import
Queue
,
Empty
import
urllib2
from
django.core.management.base
import
NoArgs
Command
from
django.core.management.base
import
Base
Command
from
django.db
import
transaction
from
django.utils.timezone
import
now
...
...
@@ -43,16 +42,23 @@
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment